Class JettyAsyncWorkflowInterceptor
- java.lang.Object
-
- com.adaptris.core.interceptor.WorkflowInterceptorImpl
-
- com.adaptris.core.http.jetty.JettyWorkflowInterceptorImpl
-
- com.adaptris.core.http.jetty.JettyAsyncWorkflowInterceptor
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,StateManagedComponent
,WorkflowInterceptor
@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
Allows you to handle a single HTTP request across 2 workflows within the same Interlok instance.Configure one of these with
mode=REQUEST
in the workflow with theJettyMessageConsumer
; and then in your reply workflow, configure one of these withmode=RESPONSE
. When the reply workflow is finished; then the jetty response will be committed back to the caller.- Since:
- 3.7.3
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JettyAsyncWorkflowInterceptor.Mode
-
Nested classes/interfaces inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
WorkflowInterceptorImpl.WorkflowInterceptorException
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
log
-
-
Constructor Summary
Constructors Constructor Description JettyAsyncWorkflowInterceptor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.adaptris.core.http.jetty.JettyWorkflowInterceptorImpl
close, endWorkflow, messageComplete, start, stop
-
Methods inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.WorkflowInterceptor
processingStart
-
-
-
-
Method Detail
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classJettyWorkflowInterceptorImpl
- Throws:
CoreException
- wrapping any underlyingException
s
-
workflowStart
public void workflowStart(AdaptrisMessage inputMsg)
Description copied from interface:WorkflowInterceptor
Mark the start of a workflow. This doesn't mean the message has started processing but only that the message will - at some point - be processed by the workflow.- Parameters:
inputMsg
- the message that will be processed by this workflow.
-
workflowEnd
public void workflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)
Description copied from interface:WorkflowInterceptor
Mark the end of a workflow.- Parameters:
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.- See Also:
CoreConstants.OBJ_METADATA_EXCEPTION
-
getMode
public JettyAsyncWorkflowInterceptor.Mode getMode()
-
setMode
public void setMode(JettyAsyncWorkflowInterceptor.Mode m)
Set the mode.- Parameters:
m
-
-
withMode
public JettyAsyncWorkflowInterceptor withMode(JettyAsyncWorkflowInterceptor.Mode m)
-
cacheContains
public static boolean cacheContains(java.lang.String msgId)
-
removeEntry
public static boolean removeEntry(java.lang.String msgId)
-
getCacheKey
public java.lang.String getCacheKey()
-
setCacheKey
public void setCacheKey(java.lang.String s)
Set the key for the cache.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 viaInterlokMessage.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 theInterlokMessage.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 JMS, then you might need to specify a value here so that theJMSCorrelationID
(viaMetadataCorrelationIdSource
) 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.- Parameters:
s
- the cache key e.g. %message{JMSCorrelationID} when the mode isJettyAsyncWorkflowInterceptor.Mode.RESPONSE
;
-
withCacheKey
public JettyAsyncWorkflowInterceptor withCacheKey(java.lang.String s)
-
-