Package org.frankframework.core
Class PipeLine
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.core.PipeLine
- All Implemented Interfaces:
ICacheEnabled<String,,String> ConfigurationAware,FrankElement,HasApplicationContext,HasName,HasTransactionAttribute,IConfigurable,IScopeProvider,ConfigurableLifecycle,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
@Category(BASIC)
@FrankDocGroup(OTHER)
public class PipeLine
extends TransactionAttributes
implements ICacheEnabled<String,String>, FrankElement, ConfigurationAware, ConfigurableLifecycle
Required in each
The pipes in a
A pipeline gathers statistics about the messages it processes.
In the AppConstants there may be a property named
Transaction control
THE FOLLOWING TO BE UPDATED, attribute 'transacted' replaced by 'transactionAttribute' If
Adapter to transform incoming messages. A pipeline
is a sequence of pipes. A
pipeline also defines its allowed end states using the <Exits>
tag.
The pipes in a
PipeLine may not be executed in sequential order, see PipeForward.
A pipeline gathers statistics about the messages it processes.
In the AppConstants there may be a property named
log.logIntermediaryResults (true/false)
which indicates whether the intermediary results (between calling pipes) have to be logged.
Transaction control
THE FOLLOWING TO BE UPDATED, attribute 'transacted' replaced by 'transactionAttribute' If
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.- Author:
- Johan Verrips
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.frankframework.core.TransactionAttributes
logFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddForward(PipeForward forward) Deprecated.voidRegister a Pipe at this pipeline.voidaddPipeLineExit(PipeLineExit exit) Deprecated.voidConfigures the pipes of this Pipeline and does some basic checks.voidfindGlobalForward(String forward) longgetName()Used byMetricsInitializerandConfigurationWarnings.intgetPhase()getPipe(int index) intio.micrometer.core.instrument.DistributionSummarygetPipeSizeInStatistics(IPipe pipe) io.micrometer.core.instrument.DistributionSummaryio.micrometer.core.instrument.DistributionSummarygetPipeStatistics(IPipe pipe) io.micrometer.core.instrument.DistributionSummarygetPipeWaitStatistics(IPipe pipe) booleanprocess(String messageId, Message message, PipeLineSession pipeLineSession) Theprocessmethod does the processing of a message.
It retrieves the first pipe to execute from thefirstPipefield, the call results in a PipRunResult, containing the next pipe to activate.resolveForward(IPipe pipe, PipeForward forward) Find the destination of the forward, i.e. theobject(Pipe or PipeLineExit) where the forward points to.voidDeprecated.final voidsetApplicationContext(org.springframework.context.ApplicationContext context) voidCache of resultsvoidsetExpectsSessionKeys(String expectsSessionKeys) The pipeline of this adapter expects to use the following session keys to be set on call.voidsetFirstPipe(String pipeName) Name of the first pipe to execute when a message is to be processed.voidsetGlobalForwards(PipeForwards forwards) Optional global forwards that will be added to every pipe, when the forward name has not been explicitly set.voidsetInputValidator(IValidator inputValidator) Request validator, or combined validator for request and responsevoidsetInputWrapper(IWrapperPipe inputWrapper) Optional pipe to extract the request message from its envelopevoidOptional Locker, to avoid parallel execution of the PipeLine by multiple threads on multiple servers.voidsetMaxThreads(int newMaxThreads) Maximum number of threads that may execute this Pipeline simultaneously, use 0 to disable limitvoidIf messageSizeWarn>=0 and the size of the input or result pipe message exceeds the value specified a warning message is logged.voidsetOutputValidator(IValidator outputValidator) Optional pipe to validate the response.voidsetOutputWrapper(IWrapperPipe outputWrapper) Optional pipe to wrap the response message in an envelopevoidsetPipeLineExits(PipeLineExits exits) PipeLine exits.voidsetStoreOriginalMessageWithoutNamespaces(boolean b) If settruethe original message without namespaces (and prefixes) is stored under the session key originalMessageWithoutNamespacesvoidwhen specified andnullis received as a message the message is changed to the specified valuevoidstart()protected voidvoidstop()Close the pipeline.protected voidtoString()Methods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.frankframework.lifecycle.ConfigurableLifecycle
isAutoStartup, isConfiguredMethods inherited from interface org.frankframework.configuration.ConfigurationAware
setConfigurationMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.HasTransactionAttribute
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttributeMethods inherited from interface org.frankframework.cache.ICacheEnabled
getCacheMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
INPUT_VALIDATOR_NAME
- See Also:
-
OUTPUT_VALIDATOR_NAME
- See Also:
-
INPUT_WRAPPER_NAME
- See Also:
-
OUTPUT_WRAPPER_NAME
- See Also:
-
DEFAULT_SUCCESS_EXIT_NAME
- See Also:
-
-
Constructor Details
-
PipeLine
public PipeLine()
-
-
Method Details
-
setApplicationContext
public final void setApplicationContext(@Nonnull org.springframework.context.ApplicationContext context) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getName
Used byMetricsInitializerandConfigurationWarnings. When null either the ClassName or nothing is used. See PipeLineTest#testDuplicateExits, which right now does not add a name to the ConfigurationWarnings. Ideally it copies over the adapter name. -
getPipe
-
getPipe
-
configure
Configures the pipes of this Pipeline and does some basic checks. It also registers thePipeLineSessionobject at the pipes.- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classTransactionAttributes- Throws:
ConfigurationException- in case it was not able to configure the component.- See Also:
-
configure
- Throws:
ConfigurationException
-
findExitByState
-
getPipeLineSize
public int getPipeLineSize()- Returns:
- the number of pipes in the pipeline
-
getPipeStatistics
-
getPipeWaitStatistics
-
getPipeSizeInStatistics
@Nonnull public io.micrometer.core.instrument.DistributionSummary getPipeSizeInStatistics(IPipe pipe) -
getPipeSizeOutStatistics
@Nonnull public io.micrometer.core.instrument.DistributionSummary getPipeSizeOutStatistics(IPipe pipe) -
process
public PipeLineResult process(@Nonnull String messageId, @Nonnull Message message, @Nonnull PipeLineSession pipeLineSession) throws PipeRunException Theprocessmethod does the processing of a message.
It retrieves the first pipe to execute from thefirstPipefield, the call results in a PipRunResult, containing the next pipe to activate. While processing the process method keeps statistics.- Parameters:
messageId- A unique id for this message, used for logging purposes.message- The message as received from the Listener- Returns:
- the result of the processing.
- Throws:
PipeRunException- when something went wrong in the pipes.
-
resolveForward
Find the destination of the forward, i.e. theobject(Pipe or PipeLineExit) where the forward points to.- Throws:
PipeRunException
-
start
public void start()- Specified by:
startin interfaceConfigurableLifecycle- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceConfigurableLifecycle- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
startPipe
-
stop
public void stop()Close the pipeline. This will call thestop()method of all registeredPipes- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- See Also:
-
findGlobalForward
-
getAllPipeLineExits
-
stopPipe
-
toString
-
setInputValidator
Request validator, or combined validator for request and response -
setOutputValidator
Optional pipe to validate the response. Can be specified if the response cannot be validated by the request validator -
setInputWrapper
Optional pipe to extract the request message from its envelope -
setOutputWrapper
Optional pipe to wrap the response message in an envelope -
setPipeLineExits
-
addPipeLineExit
Deprecated.PipeLine exits. -
setGlobalForwards
Optional global forwards that will be added to every pipe, when the forward name has not been explicitly set. For example the<forward name="exception" path="error_exception" />, which will add theexceptionforward to every pipe in the pipeline. -
addForward
Deprecated. -
setLocker
Optional Locker, to avoid parallel execution of the PipeLine by multiple threads on multiple servers. The Pipeline is NOT executed (and is considered to have ended successfully) when the lock cannot be obtained, e.g. in case another thread, may be in another server, holds the lock and does not release it in a timely manner. If only the number of threads executing this PipeLine needs to be limited, the attribute maxThreads can be set instead, avoiding the database overhead. -
setCache
Cache of results- Specified by:
setCachein interfaceICacheEnabled<String,String>
-
addPipe
Register a Pipe at this pipeline. The name is also put in the globalForwards table (with forward-name=pipename and forward-path=pipename, so that pipe can look for a specific pipe-name. If already a globalForward exists under that name, the pipe is NOT added, allowing globalForwards to prevail.- Throws:
ConfigurationException- See Also:
-
setFirstPipe
Name of the first pipe to execute when a message is to be processed.- Default value
- first pipe of the pipeline
-
setMaxThreads
public void setMaxThreads(int newMaxThreads) Maximum number of threads that may execute this Pipeline simultaneously, use 0 to disable limit- Default value
- 0
-
setStoreOriginalMessageWithoutNamespaces
public void setStoreOriginalMessageWithoutNamespaces(boolean b) If settruethe original message without namespaces (and prefixes) is stored under the session key originalMessageWithoutNamespaces- Default value
- false
-
setMessageSizeWarn
If messageSizeWarn>=0 and the size of the input or result pipe message exceeds the value specified a warning message is logged. You can specify the value with the suffixesKB,MBorGB- Default value
- application default (30MB)
-
getMessageSizeWarnNum
public long getMessageSizeWarnNum() -
setTransformNullMessage
when specified andnullis received as a message the message is changed to the specified value -
setAdapterToRunBeforeOnEmptyInput
@Deprecated @ConfigurationWarning("Please use an XmlIf-pipe and call a sub-adapter to retrieve a new/different response") public void setAdapterToRunBeforeOnEmptyInput(String s) Deprecated.when specified and an empty message is received the specified adapter is run before passing the message (response from specified adapter) to the pipeline -
setExpectsSessionKeys
The pipeline of this adapter expects to use the following session keys to be set on call. This is for adapters that are called as sub-adapters from other adapters. This serves both for documentation, so callers can see what session keys to set on call, and for verification that those session keys are present.- Parameters:
expectsSessionKeys- Session keys to set on call of the pipeline, comma-separated.
-