@ComponentProfile(summary="Workflow designed for synchronous replies back to the requestor", tag="workflow,base") public class RequestReplyWorkflow extends StandardWorkflow
Workflow
to handle synchronous replies.
Key differences to StandardWorkflow
are
request
method of the configured AdaptrisMessageProducer
.setReplyServiceCollection(ServiceCollection)
and setReplyProducer(AdaptrisMessageProducer)
which are
used to process any messages prior to returning it back to the requestorCoreConstants.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.
eventHandler, log, startTime, stopTime
PREVIOUS_GUID_KEY, WORKFLOW_ID_KEY
Constructor and Description |
---|
RequestReplyWorkflow()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeWorkflow()
Close the workflow.
|
void |
doProduce(AdaptrisMessage msg)
Overrides
Workflow to provide req-rep functionality. |
AdaptrisMessageProducer |
getReplyProducer()
Returns the
AdaptrisMessageProducer to use for the reply. |
ServiceCollection |
getReplyServiceCollection()
Returns the
ServiceCollection 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 this
Workflow 's Channel . |
void |
setReplyProducer(AdaptrisMessageProducer producer)
Sets the
AdaptrisMessageProducer to use for the reply. |
void |
setReplyServiceCollection(ServiceCollection services)
Sets the
ServiceCollection 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.
|
handleMessage, onAdaptrisMessage, resubmitMessage
addConsumeLocation, addInterceptor, changeState, channelUnavailableWait, close, copyExceptionHeaders, disableMessageCount, friendlyName, getChannelUnavailableWaitInterval, getConsumer, getDisableDefaultMessageCount, getInterceptors, getLogPayload, getMessageErrorHandler, getMessageLogger, getProduceExceptionHandler, getProducer, getSendEvents, getServiceCollection, getUniqueId, handleBadMessage, handleBadMessage, handleChannelUnavailable, handleProduceException, init, lastStartTime, lastStopTime, logSuccess, messageLogger, obtainChannel, obtainWorkflowId, prepare, registerActiveMsgErrorHandler, registerEventHandler, requestClose, requestInit, requestStart, requestStop, retrieveActiveMsgErrorHandler, retrieveComponentState, sendMessageLifecycleEvent, setChannelUnavailableWaitInterval, setConsumer, setDisableDefaultMessageCount, setInterceptors, setLogPayload, setMessageErrorHandler, setMessageLogger, setProduceExceptionHandler, setProducer, setSendEvents, setServiceCollection, setUniqueId, start, stop, workflowEnd, workflowStart
public RequestReplyWorkflow()
Creates a new instance. Default timeout is 30 seconds, other defaults prevent NullPointerExceptions.
public void doProduce(AdaptrisMessage msg) throws ServiceException, ProduceException
Overrides Workflow
to provide req-rep functionality. Exceptions are correctly handled in super-class.
doProduce
in interface Workflow
doProduce
in class WorkflowImp
msg
- the message to processProduceException
- from both request and reply produceServiceException
- from reply servicesWorkflow.doProduce(AdaptrisMessage)
protected void initialiseWorkflow() throws CoreException
WorkflowImp
initialiseWorkflow
in class StandardWorkflowImpl
CoreException
- encapsulating any underlying ExceptionWorkflowImp.initialiseWorkflow()
protected void startWorkflow() throws CoreException
WorkflowImp
startWorkflow
in class StandardWorkflowImpl
CoreException
- encapsulating any underlying ExceptionWorkflowImp.startWorkflow()
protected void stopWorkflow()
WorkflowImp
stopWorkflow
in class StandardWorkflowImpl
WorkflowImp.stopWorkflow()
protected void closeWorkflow()
WorkflowImp
closeWorkflow
in class StandardWorkflowImpl
WorkflowImp.closeWorkflow()
public void registerChannel(Channel c) throws CoreException
Workflow
Sets a reference to this Workflow
's Channel
.
registerChannel
in interface Workflow
registerChannel
in class WorkflowImp
c
- this Workflow
's Channel
CoreException
Workflow.registerChannel(com.adaptris.core.Channel)
public void setReplyServiceCollection(ServiceCollection services)
Sets the ServiceCollection
to use on the reply. May not be null.
services
- the ServiceCollection
to use on the replypublic ServiceCollection getReplyServiceCollection()
Returns the ServiceCollection
to use on the reply.
ServiceCollection
to use on the replypublic 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.
producer
- the AdaptrisMessageProducer
to use for the replypublic AdaptrisMessageProducer getReplyProducer()
Returns the AdaptrisMessageProducer
to use for the reply.
AdaptrisMessageProducer
to use for the replypublic TimeInterval getReplyTimeout()
public void setReplyTimeout(TimeInterval replyTimeout)
replyTimeout
- the time to wait for a reply.public void setRetainUniqueId(java.lang.Boolean b)
b
- true or falsepublic java.lang.Boolean getRetainUniqueId()
protected void prepareWorkflow() throws CoreException
prepareWorkflow
in class StandardWorkflowImpl
CoreException