@ComponentProfile(summary="Interceptor that allows a HTTP request to be handled multiple workflows", tag="interceptor,http,https", since="3.7.3") public class JettyAsyncWorkflowInterceptor extends JettyWorkflowInterceptorImpl
Configure one of these with mode=REQUEST
in the workflow with the JettyMessageConsumer
; and then in your reply
workflow, configure one of these with mode=RESPONSE
. When the reply workflow is finished; then the jetty response will be
committed back to the caller.
In the adapter configuration file this class is aliased as jetty-async-workflow-interceptor which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Class and Description |
---|---|
static class |
JettyAsyncWorkflowInterceptor.Mode |
WorkflowInterceptorImpl.WorkflowInterceptorException
Constructor and Description |
---|
JettyAsyncWorkflowInterceptor() |
Modifier and Type | Method and Description |
---|---|
static boolean |
cacheContains(java.lang.String msgId) |
java.lang.String |
getCacheKey() |
JettyAsyncWorkflowInterceptor.Mode |
getMode() |
void |
init()
Initialises the component.
|
static boolean |
removeEntry(java.lang.String msgId) |
void |
setCacheKey(java.lang.String s)
Set the key for the cache.
|
void |
setMode(JettyAsyncWorkflowInterceptor.Mode m)
Set the mode.
|
JettyAsyncWorkflowInterceptor |
withCacheKey(java.lang.String s) |
JettyAsyncWorkflowInterceptor |
withMode(JettyAsyncWorkflowInterceptor.Mode m) |
void |
workflowEnd(AdaptrisMessage inputMsg,
AdaptrisMessage outputMsg)
Mark the end of a workflow.
|
void |
workflowStart(AdaptrisMessage inputMsg)
Mark the start of a workflow.
|
close, endWorkflow, messageComplete, start, stop
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
init
in class JettyWorkflowInterceptorImpl
CoreException
- wrapping any underlying Exception
spublic 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
public JettyAsyncWorkflowInterceptor.Mode getMode()
public void setMode(JettyAsyncWorkflowInterceptor.Mode m)
m
- public JettyAsyncWorkflowInterceptor withMode(JettyAsyncWorkflowInterceptor.Mode m)
public static boolean cacheContains(java.lang.String msgId)
public static boolean removeEntry(java.lang.String msgId)
public java.lang.String getCacheKey()
public void setCacheKey(java.lang.String s)
Set the key in the cache that will be used to track the underlying response. If left blank, then it will use
InterlokMessage.getUniqueId()
as the key. If specified, then that key (after metadata solution via
InterlokMessage.resolve(String)
) will be used.
Generally speaking JMS providers will assign a message-id for you when you create a javax.jms.Message
; this becomes the
InterlokMessage.getUniqueId()
in most cases. If Interlok is in use at all stages, then this can be left blank, as we
will try as much to preserve our message unique-id across JMS providers; if there is an external application integrated with a
JMS, then you might need to specify a value here so that the JMSCorrelationID
(via
MetadataCorrelationIdSource
) is used to key the cache when responding back to the HTTP client.
Note that because this is an interceptor; the only metadata you have is that which is present upon entry into the
workflow (i.e. that set by the consumer); in REQUEST mode, you only get the metadata that is set by
JettyMessageConsumer
which is not much.
s
- the cache key e.g. %message{JMSCorrelationID} when the mode is JettyAsyncWorkflowInterceptor.Mode.REQUEST
; dangerous to use when the mode is
JettyAsyncWorkflowInterceptor.Mode.REQUEST
.public JettyAsyncWorkflowInterceptor withCacheKey(java.lang.String s)