public class ThreadsProcessor
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.spi.IdAware
Exchange
s
using the asynchronous routing engine.
Notice: For transacted routes then this ThreadsProcessor
is not in use, as we want to
process messages using the same thread to support all work done in the same transaction. The reason
is that the transaction manager that orchestrate the transaction, requires all the work to be done
on the same thread.
Pay attention to how this processor handles rejected tasks.
RejectedExecutionException
exception,
and marked to stop continue routing.
The UnitOfWork
will be regarded as failed, due the exception.UnitOfWork
will be regarded as successful, due no exception being set.UnitOfWork
will be regarded as successful, due no exception being set.
And the current exchange will be added to the task queue.Constructor and Description |
---|
ThreadsProcessor(org.apache.camel.CamelContext camelContext,
ExecutorService executorService,
boolean shutdownExecutorService,
org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy) |
Modifier and Type | Method and Description |
---|---|
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
ExecutorService |
getExecutorService() |
String |
getId() |
org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy |
getRejectedPolicy() |
boolean |
process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback) |
void |
setId(String id) |
String |
toString() |
build, doBuild, doInit, doResume, doSuspend, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public ThreadsProcessor(org.apache.camel.CamelContext camelContext, ExecutorService executorService, boolean shutdownExecutorService, org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
process
in interface org.apache.camel.AsyncProcessor
public ExecutorService getExecutorService()
public String getId()
getId
in interface org.apache.camel.spi.HasId
public void setId(String id)
setId
in interface org.apache.camel.spi.IdAware
public org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy getRejectedPolicy()
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.AsyncProcessorSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.AsyncProcessorSupport
Exception
Apache Camel