Search in sources :

Example 26 with SendProcessor

use of org.apache.camel.processor.SendProcessor in project camel by apache.

the class AsyncEndpointRoutingSlipBeanNonBlockingTest method testAsyncEndpointDontBlock.

public void testAsyncEndpointDontBlock() throws Exception {
    getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
    Endpoint startEndpoint = context.getEndpoint("direct:start");
    SendProcessor asyncSender = new SendProcessor(startEndpoint);
    ServiceHelper.startService(asyncSender);
    ExecutorService executorService = context.getExecutorServiceManager().newSingleThreadExecutor(this, "test");
    try {
        Future<Boolean> asyncFuture = executorService.submit(new ExchangeSubmitter(startEndpoint, asyncSender));
        Assert.assertFalse(asyncFuture.get(5, TimeUnit.SECONDS));
        innerExchange.getOut().setBody("Bye Camel");
        innerCallback.done(false);
        assertMockEndpointsSatisfied();
    } finally {
        executorService.shutdown();
        ServiceHelper.stopAndShutdownService(asyncSender);
    }
}
Also used : Endpoint(org.apache.camel.Endpoint) ExecutorService(java.util.concurrent.ExecutorService) SendProcessor(org.apache.camel.processor.SendProcessor)

Example 27 with SendProcessor

use of org.apache.camel.processor.SendProcessor in project camel by apache.

the class DeadLetterChannelBuilder method getFailureProcessor.

// Properties
// -------------------------------------------------------------------------
public Processor getFailureProcessor() {
    if (failureProcessor == null) {
        // wrap in our special safe fallback error handler if sending to dead letter channel fails
        Processor child = new SendProcessor(deadLetter, ExchangePattern.InOnly);
        // force MEP to be InOnly so when sending to DLQ we would not expect a reply if the MEP was InOut
        failureProcessor = new FatalFallbackErrorHandler(child, true);
    }
    return failureProcessor;
}
Also used : Processor(org.apache.camel.Processor) SendProcessor(org.apache.camel.processor.SendProcessor) FatalFallbackErrorHandler(org.apache.camel.processor.FatalFallbackErrorHandler) SendProcessor(org.apache.camel.processor.SendProcessor)

Aggregations

SendProcessor (org.apache.camel.processor.SendProcessor)27 Processor (org.apache.camel.Processor)17 AggregateProcessor (org.apache.camel.processor.aggregate.AggregateProcessor)15 Exchange (org.apache.camel.Exchange)14 Expression (org.apache.camel.Expression)14 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)14 DefaultExchange (org.apache.camel.impl.DefaultExchange)14 BodyInAggregatingStrategy (org.apache.camel.processor.BodyInAggregatingStrategy)14 AggregationStrategy (org.apache.camel.processor.aggregate.AggregationStrategy)14 Endpoint (org.apache.camel.Endpoint)7 Predicate (org.apache.camel.Predicate)5 Channel (org.apache.camel.Channel)4 Route (org.apache.camel.Route)4 EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)4 DeadLetterChannel (org.apache.camel.processor.DeadLetterChannel)4 ProcessorTransformer (org.apache.camel.impl.transformer.ProcessorTransformer)2 Field (java.lang.reflect.Field)1 Iterator (java.util.Iterator)1 ExecutorService (java.util.concurrent.ExecutorService)1 CamelContext (org.apache.camel.CamelContext)1