@Category(value="Basic") public class PipeLine extends TransactionAttributes implements ICacheEnabled<String,String>, HasStatistics, IConfigurationAware
Adapter
to transform incoming messages. A pipeline
is a sequence of pipes. A
pipeline also defines its allowed end states using the <Exits>
tag.
PipeLine
may not be executed in sequential order, see PipeForward
.
log.logIntermediaryResults
(true/false)
which indicates whether the intermediary results (between calling pipes) have to be logged.
transacted
is set to true
, messages will be processed
under transaction control. Processing by XA-compliant pipes (i.e. Pipes that implement the
IXAEnabled-interface, set their transacted-attribute to true
and use XA-compliant
resources) will then either be committed or rolled back in one transaction.
If transacted
is set to true
, either an existing transaction
(started by a transactional receiver) is joined, or new one is created (if the message processing request
is not initiated by a receiver under transaction control.
Messages are only committed or rolled back by the Pipeline if it started the transaction itself. If
the pipeline joined an existing transaction, the commit or rollback is left to the object that started
the transaction, i.e. the receiver. In the latter case the pipeline can indicate to the receiver that the
transaction should be rolled back (by calling UserTransaction.setRollBackOnly()).
The choice whether to either commit (by Pipeline or Receiver) or rollback (by Pipeline or Receiver)
is made as follows:
If the processing of the message concluded without exceptions and the status of the transaction is
STATUS_ACTIVE (i.e. normal) the transaction will be committed. Otherwise it will be rolled back,
or marked for roll back by the calling party.Modifier and Type | Class and Description |
---|---|
static class |
PipeLine.ExitState |
HasStatistics.Action
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SUCCESS_EXIT_NAME |
static String |
INPUT_VALIDATOR_NAME |
static String |
INPUT_WRAPPER_NAME |
static String |
OUTPUT_VALIDATOR_NAME |
static String |
OUTPUT_WRAPPER_NAME |
static String |
PIPELINE_DURATION_STATS |
static String |
PIPELINE_SIZE_STATS |
static String |
PIPELINE_WAIT_STATS |
log
Constructor and Description |
---|
PipeLine() |
Modifier and Type | Method and Description |
---|---|
void |
addPipe(IPipe pipe)
Register an Pipe at this pipeline.
|
boolean |
configurationSucceeded() |
void |
configure()
Configures the pipes of this Pipeline and does some basic checks.
|
void |
configure(IPipe pipe) |
PipeLineExit |
findExitByState(PipeLine.ExitState state) |
long |
getMessageSizeWarnNum() |
String |
getName() |
IPipe |
getPipe(int index) |
IPipe |
getPipe(String pipeName) |
int |
getPipeLineSize() |
StatisticsKeeper |
getPipeSizeStatistics(INamedObject no) |
StatisticsKeeper |
getPipeSizeStatistics(IPipe pipe) |
StatisticsKeeper |
getPipeStatistics(INamedObject pipe) |
StatisticsKeeper |
getPipeWaitingStatistics(IPipe pipe) |
void |
iterateOverStatistics(StatisticsKeeperIterationHandler hski,
Object data,
HasStatistics.Action action) |
PipeLineResult |
process(String messageId,
Message message,
PipeLineSession pipeLineSession)
The process method does the processing of a message.It retrieves the first pipe to execute from the firstPipe
|
void |
registerExitHandler(IPipeLineExitHandler exitHandler) |
void |
registerForward(PipeForward forward)
Deprecated.
|
void |
registerPipeLineExit(PipeLineExit exit)
Deprecated.
|
IForwardTarget |
resolveForward(IPipe pipe,
PipeForward forward)
Find the destination of the forward, i.e.
|
void |
setAdapter(Adapter adapter)
Register the adapterName of this Pipelineprocessor.
|
void |
setAdapterToRunBeforeOnEmptyInput(String s)
Deprecated.
|
void |
setCache(ICache<String,String> cache)
Cache of results
|
void |
setFirstPipe(String pipeName)
Name of the first pipe to execute when a message is to be processed
|
void |
setGlobalForwards(PipeForwards forwards)
Global forwards
|
void |
setInputValidator(IValidator inputValidator)
Request validator, or combined validator for request and response
|
void |
setInputWrapper(IWrapperPipe inputWrapper)
Optional pipe to extract the request message from its envelope
|
void |
setLocker(Locker locker)
Optional Locker, to avoid parallel execution of the PipeLine by multiple threads on multiple servers.
|
void |
setMaxThreads(int newMaxThreads)
Maximum number of threads that may execute this Pipeline simultaneously, use 0 to disable limit
|
void |
setMessageSizeWarn(String s)
If messageSizeWarn>=0 and the size of the input or result pipe message exceeds the value specified a warning message is logged.
|
void |
setOutputValidator(IValidator outputValidator)
Optional pipe to validate the response.
|
void |
setOutputWrapper(IWrapperPipe outputWrapper)
Optional pipe to wrap the response message in an envelope
|
void |
setOwner(INamedObject owner) |
void |
setPipeLineExits(PipeLineExits exits)
PipeLine exits.
|
void |
setStoreOriginalMessageWithoutNamespaces(boolean b)
If set
true the original message without namespaces (and prefixes) is stored under the session key originalMessageWithoutNamespaces |
void |
setTransformNullMessage(String s)
when specified and
null is received as a message the message is changed to the specified value |
void |
start() |
protected void |
startPipe(String type,
IPipe pipe) |
void |
stop()
Close the pipeline.
|
protected void |
stopPipe(String type,
IPipe pipe) |
String |
toString() |
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCache
getApplicationContext
getConfigurationClassLoader
setApplicationContext
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttribute
public static final String INPUT_VALIDATOR_NAME
public static final String OUTPUT_VALIDATOR_NAME
public static final String INPUT_WRAPPER_NAME
public static final String OUTPUT_WRAPPER_NAME
public static final String PIPELINE_DURATION_STATS
public static final String PIPELINE_WAIT_STATS
public static final String PIPELINE_SIZE_STATS
public static final String DEFAULT_SUCCESS_EXIT_NAME
public IPipe getPipe(int index)
public void registerExitHandler(IPipeLineExitHandler exitHandler)
public void configure() throws ConfigurationException
PipeLineSession
object at the pipes.configure
in class TransactionAttributes
ConfigurationException
IPipe
public void configure(IPipe pipe) throws ConfigurationException
ConfigurationException
public boolean configurationSucceeded()
public PipeLineExit findExitByState(PipeLine.ExitState state)
public int getPipeLineSize()
public void iterateOverStatistics(StatisticsKeeperIterationHandler hski, Object data, HasStatistics.Action action) throws SenderException
iterateOverStatistics
in interface HasStatistics
SenderException
public StatisticsKeeper getPipeStatistics(INamedObject pipe)
public StatisticsKeeper getPipeWaitingStatistics(IPipe pipe)
public StatisticsKeeper getPipeSizeStatistics(IPipe pipe)
public StatisticsKeeper getPipeSizeStatistics(INamedObject no)
public PipeLineResult process(String messageId, Message message, PipeLineSession pipeLineSession) throws PipeRunException
process
method does the processing of a message.firstPipe
message
- The message as received from the ListenermessageId
- A unique id for this message, used for logging purposes.PipeRunException
- when something went wrong in the pipes.public IForwardTarget resolveForward(IPipe pipe, PipeForward forward) throws PipeRunException
object
(Pipe or PipeLineExit) where the forward points to.PipeRunException
public void setAdapter(Adapter adapter)
adapter
- public void setOwner(INamedObject owner)
public void start() throws PipeStartException
PipeStartException
protected void startPipe(String type, IPipe pipe) throws PipeStartException
PipeStartException
public void stop()
stop()
method
of all registered Pipes
IPipe.stop()
public String getName()
getName
in interface IConfigurationAware
public String toString()
toString
in class Object
setFirstPipe(java.lang.String)
public void setInputValidator(IValidator inputValidator)
public void setOutputValidator(IValidator outputValidator)
public void setInputWrapper(IWrapperPipe inputWrapper)
public void setOutputWrapper(IWrapperPipe outputWrapper)
public void setPipeLineExits(PipeLineExits exits)
@Deprecated public void registerPipeLineExit(PipeLineExit exit)
public void setGlobalForwards(PipeForwards forwards)
@Deprecated public void registerForward(PipeForward forward)
public void setLocker(Locker locker)
public void setCache(ICache<String,String> cache)
setCache
in interface ICacheEnabled<String,String>
public void addPipe(IPipe pipe) throws ConfigurationException
ConfigurationException
AbstractPipe
public void setFirstPipe(String pipeName)
public void setMaxThreads(int newMaxThreads)
public void setStoreOriginalMessageWithoutNamespaces(boolean b)
true
the original message without namespaces (and prefixes) is stored under the session key originalMessageWithoutNamespacespublic void setMessageSizeWarn(String s)
KB
, MB
or GB
public long getMessageSizeWarnNum()
public void setTransformNullMessage(String s)
null
is received as a message the message is changed to the specified value@Deprecated @ConfigurationWarning(value="Please use an XmlIf-pipe and call a sub-adapter to retrieve a new/different response") public void setAdapterToRunBeforeOnEmptyInput(String s)
Copyright © 2023 Frank!Framework. All rights reserved.