Search in sources :

Example 1 with NullProduceExceptionHandler

use of com.adaptris.core.NullProduceExceptionHandler in project interlok by adaptris.

the class ExampleWorkflowCase method testSetProduceExceptionHandler.

@Test
public void testSetProduceExceptionHandler() throws Exception {
    WorkflowImp wf = createWorkflowForGenericTests();
    assertNull(wf.getProduceExceptionHandler());
    ProduceExceptionHandler obj = new NullProduceExceptionHandler();
    wf.setProduceExceptionHandler(obj);
    assertEquals(obj, wf.getProduceExceptionHandler());
}
Also used : NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) ProduceExceptionHandler(com.adaptris.core.ProduceExceptionHandler) WorkflowImp(com.adaptris.core.WorkflowImp) Test(org.junit.Test)

Example 2 with NullProduceExceptionHandler

use of com.adaptris.core.NullProduceExceptionHandler in project interlok by adaptris.

the class JmsTransactedWorkflow method initialiseWorkflow.

@Override
protected void initialiseWorkflow() throws CoreException {
    AdaptrisMessageConsumer amc = getConsumer();
    if (amc instanceof JmsPollingConsumerImpl) {
        ((JmsPollingConsumerImpl) amc).setRollbackTimeout(waitPeriodAfterRollbackMs());
        ((JmsPollingConsumerImpl) amc).setTransacted(Boolean.TRUE);
    } else if (amc instanceof JmsConsumerImpl) {
        ((JmsConsumerImpl) amc).setRollbackTimeout(waitPeriodAfterRollbackMs());
        ((JmsConsumerImpl) amc).setTransacted(Boolean.TRUE);
    } else if (!(amc instanceof NullMessageConsumer)) {
        throw new CoreException(this.getClass().getSimpleName() + " must be used with a JMSConsumer");
    }
    ProduceExceptionHandler produceExceptionHandler = getProduceExceptionHandler();
    if (produceExceptionHandler != null && !(produceExceptionHandler instanceof NullProduceExceptionHandler)) {
        throw new CoreException(this.getClass().getSimpleName() + " may not have a ProduceExceptionHandler set");
    }
    super.initialiseWorkflow();
}
Also used : CoreException(com.adaptris.core.CoreException) AdaptrisMessageConsumer(com.adaptris.core.AdaptrisMessageConsumer) NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) NullProduceExceptionHandler(com.adaptris.core.NullProduceExceptionHandler) ProduceExceptionHandler(com.adaptris.core.ProduceExceptionHandler) NullMessageConsumer(com.adaptris.core.NullMessageConsumer)

Aggregations

NullProduceExceptionHandler (com.adaptris.core.NullProduceExceptionHandler)2 ProduceExceptionHandler (com.adaptris.core.ProduceExceptionHandler)2 AdaptrisMessageConsumer (com.adaptris.core.AdaptrisMessageConsumer)1 CoreException (com.adaptris.core.CoreException)1 NullMessageConsumer (com.adaptris.core.NullMessageConsumer)1 WorkflowImp (com.adaptris.core.WorkflowImp)1 Test (org.junit.Test)1