Search in sources :

Example 1 with JettyPoolingWorkflowInterceptor

use of com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor in project interlok by adaptris.

the class WorkflowManagerTest method testJettyInterceptor_AlreadyHasInterceptor.

@Test
public void testJettyInterceptor_AlreadyHasInterceptor() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    AdapterManager adapterManager = new AdapterManager(adapter);
    Channel channel = createChannel("c1");
    ChannelManager channelManager = new ChannelManager(channel, adapterManager);
    PoolingWorkflow workflow = new PoolingWorkflow("w1");
    workflow.addInterceptor(new JettyPoolingWorkflowInterceptor());
    workflow.setConsumer(new JettyMessageConsumer());
    new WorkflowManager(workflow, channelManager);
    assertEquals(3, workflow.getInterceptors().size());
    // Look the order should now be swapped.
    assertEquals(JettyPoolingWorkflowInterceptor.class, workflow.getInterceptors().get(0).getClass());
    assertEquals(MessageMetricsInterceptor.class, workflow.getInterceptors().get(1).getClass());
    assertEquals(InFlightWorkflowInterceptor.class, workflow.getInterceptors().get(2).getClass());
}
Also used : Channel(com.adaptris.core.Channel) JettyPoolingWorkflowInterceptor(com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor) Adapter(com.adaptris.core.Adapter) JettyMessageConsumer(com.adaptris.core.http.jetty.JettyMessageConsumer) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) Test(org.junit.Test)

Example 2 with JettyPoolingWorkflowInterceptor

use of com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor in project interlok by adaptris.

the class WorkflowManager method configureJettyInterceptor.

private void configureJettyInterceptor() throws CoreException, MalformedObjectNameException {
    // that object monitors are in place for re-entrant servlet action.
    if (PoolingWorkflow.class.isAssignableFrom(managedWorkflow.getClass()) && BasicJettyConsumer.class.isAssignableFrom(managedWorkflow.getConsumer().getClass())) {
        if (!hasInterceptorOfType(managedWorkflow.getInterceptors(), JettyWorkflowInterceptorImpl.class)) {
            log.trace("JettyPoolingWorkflowInterceptor added for [{}]", createObjectName());
            managedWorkflow.getInterceptors().add(new JettyPoolingWorkflowInterceptor());
        }
    }
}
Also used : JettyWorkflowInterceptorImpl(com.adaptris.core.http.jetty.JettyWorkflowInterceptorImpl) JettyPoolingWorkflowInterceptor(com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor) BasicJettyConsumer(com.adaptris.core.http.jetty.BasicJettyConsumer) PoolingWorkflow(com.adaptris.core.PoolingWorkflow)

Aggregations

PoolingWorkflow (com.adaptris.core.PoolingWorkflow)2 JettyPoolingWorkflowInterceptor (com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor)2 Adapter (com.adaptris.core.Adapter)1 Channel (com.adaptris.core.Channel)1 BasicJettyConsumer (com.adaptris.core.http.jetty.BasicJettyConsumer)1 JettyMessageConsumer (com.adaptris.core.http.jetty.JettyMessageConsumer)1 JettyWorkflowInterceptorImpl (com.adaptris.core.http.jetty.JettyWorkflowInterceptorImpl)1 Test (org.junit.Test)1