@ComponentProfile(summary="Interceptor that automatically returns a 503 if its parent workflow is busy.", tag="interceptor,http,https", since="3.7.3") public class JettyNoBacklogInterceptor extends WorkflowInterceptorImpl
Note that this interceptor only works with PoolingWorkflow
; results are undefined when used with other workflows. What
actually happens is that if the current message (during workflowStart()) increases the count of messages in flight over the
maximum pool size then a 503 Server Busy
is immediately returned. The message is also marked with
CoreConstants.STOP_PROCESSING_KEY
and CoreConstants.KEY_WORKFLOW_SKIP_PRODUCER
which will cause the underlying
workflow to skip processing the message (effectively the message will be discarded); you will see logging to that effect at
TRACE/DEBUG level.
In the adapter configuration file this class is aliased as jetty-no-backlog-interceptor which is the preferred alternative to the fully qualified classname when building your configuration.
WorkflowInterceptorImpl.WorkflowInterceptorException
log
Constructor and Description |
---|
JettyNoBacklogInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
void |
init()
Initialises the component.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
void |
workflowEnd(AdaptrisMessage inputMsg,
AdaptrisMessage outputMsg)
Mark the end of a workflow.
|
void |
workflowStart(AdaptrisMessage inputMsg)
Mark the start of a workflow.
|
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processingStart
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public void workflowStart(AdaptrisMessage inputMsg)
WorkflowInterceptor
inputMsg
- the message that will be processed by this workflow.public void workflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)
WorkflowInterceptor
inputMsg
- the original message that was originally submitted to the workflow; in the event of an exception during
processing, the exception will be stored in object metadata in the inputMsgoutputMsg
- the message contaning any changes that may have been applied by the services within the workflow.CoreConstants.OBJ_METADATA_EXCEPTION