Search in sources :

Example 26 with Workflow

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

the class JettyNoBacklogInterceptor method init.

@Override
public void init() throws CoreException {
    Workflow w = parentWorkflow();
    if (PoolingWorkflow.class.isAssignableFrom(w.getClass())) {
        maxWorkers = ((PoolingWorkflow) w).poolSize();
    }
    log.trace("503 Server Error will be sent when there are {} messages in flight", maxWorkers);
}
Also used : PoolingWorkflow(com.adaptris.core.PoolingWorkflow) Workflow(com.adaptris.core.Workflow)

Example 27 with Workflow

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

the class JmsConnectionErrorHandlerTest method createChannel.

private MockChannel createChannel(EmbeddedActiveMq mq, SharedConnection con, String destinationName) throws Exception {
    MockChannel result = new MockChannel();
    result.setUniqueId(mq.getName() + "_channel" + "_" + destinationName);
    result.setConsumeConnection(con);
    Workflow workflow = createWorkflow(mq, destinationName);
    result.getWorkflowList().add(workflow);
    return result;
}
Also used : MockChannel(com.adaptris.core.stubs.MockChannel) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow)

Example 28 with Workflow

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

the class MockChannel method prepare.

@Override
public void prepare() throws CoreException {
    if (eh == null) {
        eh = new DefaultEventHandler();
    }
    eh.requestStart();
    registerEventHandler(eh);
    super.prepare();
    registerActiveMsgErrorHandler(getMessageErrorHandler());
    for (Workflow workflow : getWorkflowList()) {
        if (workflow.getMessageErrorHandler() != null) {
            workflow.registerActiveMsgErrorHandler(workflow.getMessageErrorHandler());
        } else {
            workflow.registerActiveMsgErrorHandler(getMessageErrorHandler());
        }
    }
}
Also used : DefaultEventHandler(com.adaptris.core.DefaultEventHandler) Workflow(com.adaptris.core.Workflow)

Example 29 with Workflow

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

the class MessageNotificationCase method createChannel.

protected Channel createChannel(String uid, Workflow... workflows) {
    Channel c = new Channel();
    c.setUniqueId(uid);
    for (Workflow w : workflows) {
        c.getWorkflowList().add(w);
    }
    return c;
}
Also used : Channel(com.adaptris.core.Channel) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow)

Example 30 with Workflow

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

the class AdapterManagerTest method testRegisterMBean.

@Test
public void testRegisterMBean() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    Channel channel = createChannel("c1");
    Workflow workflow = createWorkflow("w1");
    workflow.getInterceptors().add(new MessageMetricsInterceptor());
    channel.getWorkflowList().add(workflow);
    adapter.getChannelList().add(channel);
    AdapterManager adapterManager = new AdapterManager(adapter);
    List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
    mBeans.add(adapterManager);
    mBeans.addAll(adapterManager.getAllDescendants());
    try {
        adapterManager.registerMBean();
        assertTrue(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName()));
        for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) {
            assertTrue(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName()));
        }
        adapterManager.unregisterMBean();
        assertFalse(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName()));
        for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) {
            assertFalse(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName()));
        }
        register(mBeans);
        assertTrue(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName()));
        for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) {
            assertTrue(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName()));
        }
    } finally {
    }
}
Also used : Channel(com.adaptris.core.Channel) ArrayList(java.util.ArrayList) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) MessageMetricsInterceptor(com.adaptris.core.interceptor.MessageMetricsInterceptor) Test(org.junit.Test)

Aggregations

Workflow (com.adaptris.core.Workflow)53 StandardWorkflow (com.adaptris.core.StandardWorkflow)49 Channel (com.adaptris.core.Channel)44 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)44 Test (org.junit.Test)43 Adapter (com.adaptris.core.Adapter)40 ObjectName (javax.management.ObjectName)30 ArrayList (java.util.ArrayList)27 CoreException (com.adaptris.core.CoreException)8 MockChannel (com.adaptris.core.stubs.MockChannel)5 Notification (javax.management.Notification)3 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 MessageMetricsInterceptor (com.adaptris.core.interceptor.MessageMetricsInterceptor)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 StaticMockMessageProducer (com.adaptris.core.stubs.StaticMockMessageProducer)2 TimeInterval (com.adaptris.util.TimeInterval)2 DefaultEventHandler (com.adaptris.core.DefaultEventHandler)1 NullProcessingExceptionHandler (com.adaptris.core.NullProcessingExceptionHandler)1 XStreamMarshaller (com.adaptris.core.XStreamMarshaller)1