public abstract class TimeoutCorrelationManagerSupport extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.CamelContextAware, NettyCamelStateCorrelationManager
NettyCamelStateCorrelationManager that supports timeout.| Constructor and Description |
|---|
TimeoutCorrelationManagerSupport() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.CamelContext |
getCamelContext() |
abstract String |
getRequestCorrelationId(Object request)
Implement this method to extract the correaltion id from the request message body.
|
abstract String |
getResponseCorrelationId(Object response)
Implement this method to extract the correaltion id from the response message body.
|
NettyCamelState |
getState(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.Channel channel,
Object msg)
Gets the state when a response message has been received.
|
NettyCamelState |
getState(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.Channel channel,
Throwable cause)
Gets the state when some internal error occurred.
|
long |
getTimeout() |
long |
getTimeoutChecker() |
org.apache.camel.LoggingLevel |
getTimeoutLoggingLevel() |
String |
getTimeoutResponse(String correlationId,
Object request)
Override this to implement a custom timeout response message.
|
ExecutorService |
getWorkerPool() |
void |
putState(io.netty.channel.Channel channel,
NettyCamelState state)
Puts the state.
|
void |
removeState(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.Channel channel)
Removes the state when the channel is inactive.
|
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setTimeout(long timeout)
Sets timeout value in millis seconds.
|
void |
setTimeoutChecker(long timeoutChecker)
Time in millis how frequent to check for timeouts.
|
void |
setTimeoutLoggingLevel(org.apache.camel.LoggingLevel timeoutLoggingLevel)
Sets the logging level to use when a timeout was hit.
|
void |
setWorkerPool(ExecutorService workerPool)
To use a shared worker pool for processing timed out requests.
|
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, suspendpublic org.apache.camel.CamelContext getCamelContext()
getCamelContext in interface org.apache.camel.CamelContextAwarepublic void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext in interface org.apache.camel.CamelContextAwarepublic long getTimeout()
public void setTimeout(long timeout)
public long getTimeoutChecker()
public void setTimeoutChecker(long timeoutChecker)
public org.apache.camel.LoggingLevel getTimeoutLoggingLevel()
public void setTimeoutLoggingLevel(org.apache.camel.LoggingLevel timeoutLoggingLevel)
public ExecutorService getWorkerPool()
public void setWorkerPool(ExecutorService workerPool)
public abstract String getRequestCorrelationId(Object request)
public abstract String getResponseCorrelationId(Object response)
public String getTimeoutResponse(String correlationId, Object request)
correlationId - the correlation idrequest - the request messageExchangeTimedOutException exception.public void putState(io.netty.channel.Channel channel,
NettyCamelState state)
NettyCamelStateCorrelationManagerNettyCamelState instance.putState in interface NettyCamelStateCorrelationManagerchannel - the channelstate - the Camel state to be storedpublic void removeState(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.Channel channel)
NettyCamelStateCorrelationManagerremoveState in interface NettyCamelStateCorrelationManagerctx - netty channel handler contextchannel - the channelpublic NettyCamelState getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Object msg)
NettyCamelStateCorrelationManagerMap instance
then this method should remove the state from the map as its no longer needed. In other
words use the Map.remove(Object) to get and remove the state.getState in interface NettyCamelStateCorrelationManagerctx - netty channel handler contextchannel - the channelmsg - the response messagepublic NettyCamelState getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Throwable cause)
NettyCamelStateCorrelationManagergetState in interface NettyCamelStateCorrelationManagerctx - netty channel handler contextchannel - the channelcause - the errorprotected void doStart()
throws Exception
doStart in class org.apache.camel.support.service.ServiceSupportExceptionprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.service.ServiceSupportExceptionApache Camel