Class RequestReplyWorkflow
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageListener
,ComponentLifecycle
,ComponentLifecycleExtension
,ConfigComment
,EventHandlerAware
,StateManagedComponent
,Workflow
Workflow
to handle synchronous replies.
Key differences to StandardWorkflow
are
- uses the
request
method of the configuredAdaptrisMessageProducer
. - has a
setReplyServiceCollection(ServiceCollection)
andsetReplyProducer(AdaptrisMessageProducer)
which are used to process any messages prior to returning it back to the requestor - Does not obey the use of
CoreConstants.KEY_WORKFLOW_SKIP_PRODUCER
, the producer is always triggered.
Note that the reply producer shares the original AdaptrisMessageConsumer
's connection, on the basis
that it will be
replying to wherever the request came from.
Note that this workflow implementation has largely been superseded by using a StandardWorkflow
or PoolingWorkflow
with the appropriate services in side it; but remains available for completeness
In the adapter configuration file this class is aliased as request-reply-workflow which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.WorkflowImp
eventHandler, log, startTime, stopTime
Fields inherited from interface com.adaptris.core.Workflow
PREVIOUS_GUID_KEY, WORKFLOW_ID_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Close the workflow.void
doProduce
(AdaptrisMessage msg) OverridesWorkflow
to provide req-rep functionality.Returns theAdaptrisMessageProducer
to use for the reply.Returns theServiceCollection
to use on the reply.protected void
Initialise the workflow.protected void
void
Sets a reference to thisWorkflow
'sChannel
.void
setReplyProducer
(AdaptrisMessageProducer producer) Sets theAdaptrisMessageProducer
to use for the reply.void
setReplyServiceCollection
(ServiceCollection services) Sets theServiceCollection
to use on the reply.void
setReplyTimeout
(TimeInterval replyTimeout) Set the time to wait for a reply.void
Set whether the reply message should retain the request message id.protected void
Start the workflow.protected void
Stop the workflow.Methods inherited from class com.adaptris.core.StandardWorkflow
onAdaptrisMessage
Methods inherited from class com.adaptris.core.StandardWorkflowImpl
handleMessage, resubmitMessage
Methods inherited from class com.adaptris.core.WorkflowImp
addConsumeLocation, addInterceptor, changeState, channelUnavailableWait, close, copyExceptionHeaders, disableMessageCount, friendlyName, getChannelUnavailableWaitInterval, getComments, getConsumer, getDisableDefaultMessageCount, getInterceptors, getMessageErrorHandler, getMessageLogger, getProduceExceptionHandler, getProducer, getSendEvents, getServiceCollection, getUniqueId, handleBadMessage, handleBadMessage, handleChannelUnavailable, handleProduceException, init, lastStartTime, lastStopTime, logSuccess, messageLogger, obtainChannel, obtainWorkflowId, prepare, processingStart, registerActiveMsgErrorHandler, registerEventHandler, requestClose, requestInit, requestStart, requestStop, retrieveActiveMsgErrorHandler, retrieveComponentState, sendEvents, sendMessageLifecycleEvent, setChannelUnavailableWaitInterval, setComments, setConsumer, setDisableDefaultMessageCount, setInterceptors, setMessageErrorHandler, setMessageLogger, setProduceExceptionHandler, setProducer, setSendEvents, setServiceCollection, setUniqueId, start, stop, workflowEnd, workflowStart
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.AdaptrisMessageListener
onAdaptrisMessage, onAdaptrisMessage
-
Constructor Details
-
RequestReplyWorkflow
public RequestReplyWorkflow()Creates a new instance. Default timeout is 30 seconds, other defaults prevent NullPointerExceptions.
-
-
Method Details
-
doProduce
Overrides
Workflow
to provide req-rep functionality. Exceptions are correctly handled in super-class.- Specified by:
doProduce
in interfaceWorkflow
- Overrides:
doProduce
in classWorkflowImp
- Parameters:
msg
- the message to process- Throws:
ProduceException
- from both request and reply produceServiceException
- from reply services- See Also:
-
initialiseWorkflow
Description copied from class:WorkflowImp
Initialise the workflow.- Overrides:
initialiseWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
- encapsulating any underlying Exception- See Also:
-
startWorkflow
Description copied from class:WorkflowImp
Start the workflow.- Overrides:
startWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
- encapsulating any underlying Exception- See Also:
-
stopWorkflow
protected void stopWorkflow()Description copied from class:WorkflowImp
Stop the workflow.- Overrides:
stopWorkflow
in classStandardWorkflowImpl
- See Also:
-
closeWorkflow
protected void closeWorkflow()Description copied from class:WorkflowImp
Close the workflow.- Overrides:
closeWorkflow
in classStandardWorkflowImpl
- See Also:
-
registerChannel
Description copied from interface:Workflow
Sets a reference to this
Workflow
'sChannel
.- Specified by:
registerChannel
in interfaceWorkflow
- Overrides:
registerChannel
in classWorkflowImp
- Parameters:
c
- thisWorkflow
'sChannel
- Throws:
CoreException
- See Also:
-
setReplyServiceCollection
Sets the
ServiceCollection
to use on the reply. May not be null.- Parameters:
services
- theServiceCollection
to use on the reply
-
getReplyServiceCollection
Returns the
ServiceCollection
to use on the reply.- Returns:
- the
ServiceCollection
to use on the reply
-
setReplyProducer
Sets the
AdaptrisMessageProducer
to use for the reply. NB uses the workflows consume connection (it's a reply...). May not be null.- Parameters:
producer
- theAdaptrisMessageProducer
to use for the reply
-
getReplyProducer
Returns the
AdaptrisMessageProducer
to use for the reply.- Returns:
- the
AdaptrisMessageProducer
to use for the reply
-
getReplyTimeout
-
setReplyTimeout
Set the time to wait for a reply.- Parameters:
replyTimeout
- the time to wait for a reply.
-
setRetainUniqueId
Set whether the reply message should retain the request message id.- Parameters:
b
- true or false
-
getRetainUniqueId
-
prepareWorkflow
- Overrides:
prepareWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
-