Search in sources :

Example 1 with InFlightWorkflowInterceptor

use of com.adaptris.core.interceptor.InFlightWorkflowInterceptor in project interlok by adaptris.

the class WorkflowManager method configureMessageCounter.

private void configureMessageCounter() throws CoreException, MalformedObjectNameException {
    if (managedWorkflow.disableMessageCount())
        return;
    if (!hasInterceptorOfType(managedWorkflow.getInterceptors(), MessageMetricsInterceptor.class)) {
        log.trace("Message count interceptor added for [{}], tracks metrics for ~1hr", createObjectName());
        String uid = managedWorkflow.getUniqueId() + MessageMetricsInterceptor.UID_SUFFIX;
        managedWorkflow.getInterceptors().add(new MessageMetricsInterceptor(uid, new TimeInterval(5L, TimeUnit.MINUTES), 12));
    }
    if (!hasInterceptorOfType(managedWorkflow.getInterceptors(), InFlightWorkflowInterceptor.class)) {
        log.trace("InFlight interceptor added for [{}]", createObjectName());
        String uid = managedWorkflow.getUniqueId() + InFlightWorkflowInterceptor.UID_SUFFIX;
        managedWorkflow.getInterceptors().add(new InFlightWorkflowInterceptor(uid));
    }
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) InFlightWorkflowInterceptor(com.adaptris.core.interceptor.InFlightWorkflowInterceptor) MessageMetricsInterceptor(com.adaptris.core.interceptor.MessageMetricsInterceptor)

Example 2 with InFlightWorkflowInterceptor

use of com.adaptris.core.interceptor.InFlightWorkflowInterceptor in project interlok by adaptris.

the class MessagesInFlightTest method buildAdapter.

private Adapter buildAdapter(PoolingWorkflow workflow) throws Exception {
    Adapter adapter = createAdapter(getName());
    Channel channel = new Channel(getName());
    workflow.setPoolSize(1);
    workflow.setShutdownWaitTime(new TimeInterval(1L, TimeUnit.SECONDS));
    workflow.addInterceptor(new InFlightWorkflowInterceptor(getName()));
    workflow.getServiceCollection().add(new WaitService(new TimeInterval(5L, TimeUnit.SECONDS)));
    channel.getWorkflowList().add(workflow);
    adapter.getChannelList().add(channel);
    return adapter;
}
Also used : WaitService(com.adaptris.core.services.WaitService) TimeInterval(com.adaptris.util.TimeInterval) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter) InFlightWorkflowInterceptor(com.adaptris.core.interceptor.InFlightWorkflowInterceptor)

Aggregations

InFlightWorkflowInterceptor (com.adaptris.core.interceptor.InFlightWorkflowInterceptor)2 TimeInterval (com.adaptris.util.TimeInterval)2 Adapter (com.adaptris.core.Adapter)1 Channel (com.adaptris.core.Channel)1 MessageMetricsInterceptor (com.adaptris.core.interceptor.MessageMetricsInterceptor)1 WaitService (com.adaptris.core.services.WaitService)1