org.apache.camel.processor
Class ThreadsProcessor
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.processor.DelegateProcessor
org.apache.camel.processor.ThreadsProcessor
- All Implemented Interfaces:
- Navigate, Processor, Service
public class ThreadsProcessor
- extends DelegateProcessor
- implements Processor
Threads processor that leverage a thread pool for processing exchanges.
The original caller thread will receive a Future<Exchange> in the OUT message body.
It can then later use this handle to obtain the async response.
Camel also provides type converters so you can just ask to get the desired object type and Camel
will automatic wait for the async task to complete to return the response.
- Version:
- $Revision: 780262 $
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop |
DEFAULT_THREADPOOL_SIZE
protected static final int DEFAULT_THREADPOOL_SIZE
- See Also:
- Constant Field Values
executorService
protected ExecutorService executorService
waitForTaskToComplete
protected WaitForTaskToComplete waitForTaskToComplete
ThreadsProcessor
public ThreadsProcessor(Processor output,
ExecutorService executorService,
WaitForTaskToComplete waitForTaskToComplete)
process
public void process(Exchange exchange)
throws Exception
- Description copied from interface:
Processor
- Processes the message exchange
- Specified by:
process
in interface Processor
- Overrides:
process
in class DelegateProcessor
- Parameters:
exchange
- the message exchange
- Throws:
Exception
- if an internal processing error has occurred.
createTask
protected Callable<Exchange> createTask(Processor output,
Exchange copy)
getExecutorService
public ExecutorService getExecutorService()
createExecutorService
protected ExecutorService createExecutorService()
doStop
protected void doStop()
throws Exception
- Overrides:
doStop
in class DelegateProcessor
- Throws:
Exception
Copyright © 2009 Apache Software Foundation. All Rights Reserved.