Class RequestReplyWorkflow
- java.lang.Object
-
- com.adaptris.core.WorkflowImp
-
- com.adaptris.core.StandardWorkflowImpl
-
- com.adaptris.core.StandardWorkflow
-
- com.adaptris.core.RequestReplyWorkflow
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageListener
,ComponentLifecycle
,ComponentLifecycleExtension
,ConfigComment
,EventHandlerAware
,StateManagedComponent
,Workflow
@ComponentProfile(summary="Workflow designed for synchronous replies back to the requestor", tag="workflow,base") public class RequestReplyWorkflow extends StandardWorkflow
Implementation ofWorkflow
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
orPoolingWorkflow
with the appropriate services in side it; but remains available for completenessIn 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
Constructors Constructor Description RequestReplyWorkflow()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeWorkflow()
Close the workflow.void
doProduce(AdaptrisMessage msg)
OverridesWorkflow
to provide req-rep functionality.AdaptrisMessageProducer
getReplyProducer()
Returns theAdaptrisMessageProducer
to use for the reply.ServiceCollection
getReplyServiceCollection()
Returns theServiceCollection
to use on the reply.TimeInterval
getReplyTimeout()
java.lang.Boolean
getRetainUniqueId()
protected void
initialiseWorkflow()
Initialise the workflow.protected void
prepareWorkflow()
void
registerChannel(Channel c)
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
setRetainUniqueId(java.lang.Boolean b)
Set whether the reply message should retain the request message id.protected void
startWorkflow()
Start the workflow.protected void
stopWorkflow()
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
-
-
-
-
Method Detail
-
doProduce
public void doProduce(AdaptrisMessage msg) throws ServiceException, ProduceException
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:
Workflow.doProduce(AdaptrisMessage)
-
initialiseWorkflow
protected void initialiseWorkflow() throws CoreException
Description copied from class:WorkflowImp
Initialise the workflow.- Overrides:
initialiseWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
- encapsulating any underlying Exception- See Also:
WorkflowImp.initialiseWorkflow()
-
startWorkflow
protected void startWorkflow() throws CoreException
Description copied from class:WorkflowImp
Start the workflow.- Overrides:
startWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
- encapsulating any underlying Exception- See Also:
WorkflowImp.startWorkflow()
-
stopWorkflow
protected void stopWorkflow()
Description copied from class:WorkflowImp
Stop the workflow.- Overrides:
stopWorkflow
in classStandardWorkflowImpl
- See Also:
WorkflowImp.stopWorkflow()
-
closeWorkflow
protected void closeWorkflow()
Description copied from class:WorkflowImp
Close the workflow.- Overrides:
closeWorkflow
in classStandardWorkflowImpl
- See Also:
WorkflowImp.closeWorkflow()
-
registerChannel
public void registerChannel(Channel c) throws CoreException
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:
Workflow.registerChannel(com.adaptris.core.Channel)
-
setReplyServiceCollection
public void setReplyServiceCollection(ServiceCollection services)
Sets the
ServiceCollection
to use on the reply. May not be null.- Parameters:
services
- theServiceCollection
to use on the reply
-
getReplyServiceCollection
public ServiceCollection getReplyServiceCollection()
Returns the
ServiceCollection
to use on the reply.- Returns:
- the
ServiceCollection
to use on the reply
-
setReplyProducer
public void setReplyProducer(AdaptrisMessageProducer producer)
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
public AdaptrisMessageProducer getReplyProducer()
Returns the
AdaptrisMessageProducer
to use for the reply.- Returns:
- the
AdaptrisMessageProducer
to use for the reply
-
getReplyTimeout
public TimeInterval getReplyTimeout()
-
setReplyTimeout
public void setReplyTimeout(TimeInterval replyTimeout)
Set the time to wait for a reply.- Parameters:
replyTimeout
- the time to wait for a reply.
-
setRetainUniqueId
public void setRetainUniqueId(java.lang.Boolean b)
Set whether the reply message should retain the request message id.- Parameters:
b
- true or false
-
getRetainUniqueId
public java.lang.Boolean getRetainUniqueId()
-
prepareWorkflow
protected void prepareWorkflow() throws CoreException
- Overrides:
prepareWorkflow
in classStandardWorkflowImpl
- Throws:
CoreException
-
-