Class JmsTransactedWorkflow
- java.lang.Object
-
- com.adaptris.core.WorkflowImp
-
- com.adaptris.core.StandardWorkflowImpl
-
- com.adaptris.core.StandardWorkflow
-
- com.adaptris.core.jms.JmsTransactedWorkflow
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageListener
,ComponentLifecycle
,ComponentLifecycleExtension
,ConfigComment
,EventHandlerAware
,StateManagedComponent
,Workflow
@ComponentProfile(summary="JMS specific workflow that supports rollback of messages", tag="workflow,jms") public final class JmsTransactedWorkflow extends StandardWorkflow
Subclass ofStandardWorkflow
for use with JMS consumers.This differs from a StandardWorkflow as it assumes that the configured JMS Consumer has a transacted session which needs to informed of any failures so the messages can be rolled back.
Additionally, this workflow may not be configured with any
ProduceExceptionHandler
as this will not allow the transaction to rolled back correctly. In order to get behaviour similiar toProduceExceptionHandler
, you should useStandaloneProducer
as part of the service collection in order to produce the payload to the required destination.In the adapter configuration file this class is aliased as jms-transacted-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 JmsTransactedWorkflow()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doProduce(AdaptrisMessage msg)
This method contains the behaviour that varies between standard and request -reply workflows.java.lang.Boolean
getStrict()
TimeInterval
getWaitPeriodAfterRollback()
protected void
handleBadMessage(java.lang.String logMsg, java.lang.Exception e, AdaptrisMessage msg)
protected void
initialiseWorkflow()
Initialise the workflow.void
setStrict(java.lang.Boolean strict)
Set the behaviour of this workflow with regards to failures.void
setWaitPeriodAfterRollback(TimeInterval interval)
set the amount of time to wait after issue aSession.rollback()
before continuing processing.long
waitPeriodAfterRollbackMs()
-
Methods inherited from class com.adaptris.core.StandardWorkflow
onAdaptrisMessage
-
Methods inherited from class com.adaptris.core.StandardWorkflowImpl
closeWorkflow, handleMessage, prepareWorkflow, resubmitMessage, startWorkflow, stopWorkflow
-
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, handleChannelUnavailable, handleProduceException, init, lastStartTime, lastStopTime, logSuccess, messageLogger, obtainChannel, obtainWorkflowId, prepare, processingStart, registerActiveMsgErrorHandler, registerChannel, 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
-
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()
-
doProduce
public void doProduce(AdaptrisMessage msg) throws ServiceException, ProduceException
Description copied from class:WorkflowImp
This method contains the behaviour that varies between standard and request -reply workflows. It is overridden in
RequestReplyWorkflow
.- Specified by:
doProduce
in interfaceWorkflow
- Overrides:
doProduce
in classWorkflowImp
- Parameters:
msg
- the message to process- Throws:
ServiceException
- not thrown by this implementationProduceException
- if any occur
-
handleBadMessage
protected void handleBadMessage(java.lang.String logMsg, java.lang.Exception e, AdaptrisMessage msg)
- Overrides:
handleBadMessage
in classWorkflowImp
-
getStrict
public java.lang.Boolean getStrict()
-
setStrict
public void setStrict(java.lang.Boolean strict)
Set the behaviour of this workflow with regards to failures.When strict mode is enabled, then any exception will cause a rollback on the session; when strict is false, then if a
ProcessingExceptionHandler
is configured that is notNullProcessingExceptionHandler
, the session will not be rolled back.- Parameters:
strict
- true or false (default true)
-
getWaitPeriodAfterRollback
public TimeInterval getWaitPeriodAfterRollback()
-
waitPeriodAfterRollbackMs
public long waitPeriodAfterRollbackMs()
-
setWaitPeriodAfterRollback
public void setWaitPeriodAfterRollback(TimeInterval interval)
set the amount of time to wait after issue aSession.rollback()
before continuing processing.- Parameters:
interval
- the interval, default if not set is 30 seconds.
-
-