To execute a processor chain in the PipelineManager
, make a call to the runProcess()
method in the PipelineManager
. This section describes what happens when a processor chain is executed.
The PipelineManager
first finds the requested chain. If the requested chain is enabled, PipelineManager
calls runProcess()
on it and passes it the user data. The runProcess()
method in the PipelineChain
manages execution of the processors. If is not enabled, an exception is thrown.
A PipelineResult
object or subclass of it is constructed. This is determined by what is defined in the PipelineChain
object.
The runProcess()
method is called on the head PipelineLink
object of the processor chain. The PipelineLink
is responsible for three actions:
Handling the transaction (if required)
Executing the processor, and
Returning the return code to the
PipelineChain
.
To handle the transaction, four methods are called before and after the call to runProcess()
in the PipelineProcessor
. These methods are called in the following order:
preChainTransaction()
postChainTransaction()
preLinkTransaction()
postLinkTransaction()
These calls make the appropriate calls and construct any required objects for the execution of the processor in the context of the transaction mode.
The runProcess()
method is called between these methods and the return value of the call is returned to the PipelineChain
. The return value of 0, which is mapped to the static variable PipelineProcessor.STOP_CHAIN_EXECUTION
, tells the PipelineManager
that execution for this chain should stop normally. Any other return value from runProcess()
indicates the next processor to execute.
STOP_CHAIN_EXECUTION
can be returned from any PipelineProcessor
, regardless of whether it has additional links or not. When STOP_CHAIN_EXECUTION
is returned, the transactions are handled and the PipelineResult
object is returned. If a value other than STOP_CHAIN_EXECUTION
is returned, the PipelineChain
calls getNextLink()
on the PipelineLink
just executed and passes it the return value it received.
This call returns another PipelineLink
to execute or null. If a PipelineLink
is returned, then the above process repeats. If null is returned, then an exception is thrown, the transaction is rolled back if needed, and this method exits throwing the appropriate exception object.