Package org.frankframework.pipes
Class MessageSendingPipe
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.pipes.AbstractPipe
org.frankframework.pipes.FixedForwardPipe
org.frankframework.pipes.MessageSendingPipe
- All Implemented Interfaces:
HasSender
,HasTransactionAttribute
,IConfigurable
,IConfigurationAware
,IForwardTarget
,INamedObject
,IPipe
,IScopeProvider
,IWithParameters
,EventThrowing
,HasStatistics
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
AsyncSenderWithListenerPipe
,IteratingPipe
,MailSenderPipe
,SenderPipe
@Forward(name="timeout") @Forward(name="illegalResult") @Forward(name="presumedTimeout") @Forward(name="interrupt") @Forward(name="*",description="{@link ISender sender} provided forward, such as the http statuscode or exit name (or code) of a sub-adapter.")
public class MessageSendingPipe
extends FixedForwardPipe
implements HasSender
- Author:
- Gerrit van Brakel
- Parameters
- Any parameters defined on the pipe will be handed to the sender, if this is a
ISenderWithParameters
. - Specific parameters
- stubFilename will not be handed to the sender and it is used at runtime instead of the stubFilename specified by the attribute. A lookup of the file for this stubFilename will be done at runtime, while the file for the stubFilename specified as an attribute will be done at configuration time.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected MetricsInitializer
static final String
static final String
static final String
static final String
static final int
static final String
static final String
static final int
protected org.apache.logging.log4j.Logger
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.frankframework.pipes.AbstractPipe
parameterNamesMustBeUnique
Fields inherited from class org.frankframework.core.TransactionAttributes
log
Fields inherited from interface org.frankframework.core.IPipe
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checks for correct configuration of forwardboolean
consumesSessionVariable
(String sessionKey) returnstrue
if the pipe or one of its children use the named session variable.protected String
doLogToMessageLog
(Message input, PipeLineSession session, Message originalMessage, String messageID, String correlationID) doPipe
(Message input, PipeLineSession session) This is where the action takes place.int
int
int
int
int
increaseRetryIntervalAndWait
(PipeLineSession session, int retryInterval, String description) boolean
protected PipeRunResult
postSendAction
(PipeRunResult sendResult, String correlationID, PipeLineSession session) protected void
CallMessage.preserve()
so it can be consumed multiple times, and wrap potentialIOException
in aPipeRunException
.protected void
protected PipeRunResult
sendMessage
(Message input, PipeLineSession session, ISender sender, Map<String, Object> threadContext) protected PipeRunResult
sendMessageWithRetries
(Message input, Message originalMessage, PipeLineSession session) void
If set, besides the XML Well-Formedness the root element of the result is checked to be equal to the value setvoid
setCheckXmlWellFormed
(boolean b) If settrue
, the XML Well-Formedness of the result is checkedvoid
setConfigurationMetrics
(MetricsInitializer configurationMetrics) void
setExceptionOnResult
(String string) If not empty, a PipeRunException is thrown when the result equals this value (for testing purposes only)void
setHideMethod
(IMessageBrowser.HideMethod hideMethod) (Only used when hideRegex is not empty and only applies to error/logstore)void
setHideRegex
(String hideRegex) Next to common usage inAbstractPipe
, also strings in the error/logstore are maskedvoid
setInputValidator
(IValidator inputValidator) specification of Pipe to validate request messages, or request and response message if configured as mixed mode validatorvoid
setInputWrapper
(IWrapperPipe inputWrapper) specification of Pipe to wrap or unwrap request messagesvoid
For asynchronous communication, the server side may either use the messageID or the correlationID in the correlationID field of the reply message.void
setMaxRetries
(int i) The number of times a processing attempt is retried after a timeout or an exception is caught or after an incorrect reply is received (see alsoretryXPath
)void
setMessageLog
(ITransactionalStorage<?> messageLog) log of all messages sentvoid
The functional name of this pipe.void
setOutputValidator
(IValidator outputValidator) specification of Pipe to validate response messagesvoid
setOutputWrapper
(IWrapperPipe outputWrapper) specification of Pipe to wrap or unwrap response messagesvoid
setPipeProcessor
(PipeProcessor pipeProcessor) void
setPresumedTimeOutInterval
(int i) If the previous call was a timeout, the maximum time in seconds after this timeout to presume the current call is also a timeout.void
setResultOnTimeOut
(String newResultOnTimeOut) The message (e.g.void
setRetryMaxInterval
(int i) The maximum number of seconds waited after an unsuccessful processing attempt before another processing attempt is madevoid
setRetryMinInterval
(int i) The starting number of seconds waited after an unsuccessful processing attempt before another processing attempt is made.void
setRetryNamespaceDefs
(String retryNamespaceDefs) Namespace defintions for retryXPath.void
setRetryXPath
(String string) XPath expression evaluated on each technical successful reply.protected void
The sender that should send the messagevoid
setStubFilename
(String filename) If set, the pipe returns a message from a file, instead of doing the regular processvoid
setTimeoutOnResult
(String string) If not empty, a TimeoutException is thrown when the result equals this value (for testing purposes only)void
setTimeOutOnResult
(String string) Deprecated.boolean
void
start()
Perform necessary action to start the pipe.void
stop()
Perform necessary actions to stop thePipe
.
For instance, closing JMS connections, DBMS connections etc.protected final String
storeMessage
(String messageID, String correlationID, Message messageToStore, String messageTrail, String label) Methods inherited from class org.frankframework.pipes.FixedForwardPipe
getIfParam, getIfValue, getOnlyIfSessionKey, getOnlyIfValue, getParameterValue, getSuccessForward, getUnlessSessionKey, getUnlessValue, isSkipOnEmptyInput, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
Methods inherited from class org.frankframework.pipes.AbstractPipe
addForward, addParameter, createBean, findForward, getAdapter, getApplicationContext, getChompCharSize, getConfigurationClassLoader, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getEventSourceName, getForwards, getGetInputFromFixedValue, getGetInputFromSessionKey, getHideRegex, getLocker, getLogIntermediaryResults, getMaxThreads, getName, getParameterList, getPipeLine, getSecLogSessionKeys, getStoreResultInSessionKey, hasRegisteredForward, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, registerEvent, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setEventPublisher, setGetInputFromFixedValue, setGetInputFromSessionKey, setLocker, setLogIntermediaryResults, setMaxThreads, setPipeLine, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, throwEvent
Methods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, getTransactionAttribute, getTransactionTimeout, getTxDef, isTransacted, isTransacted, setTransacted, setTransactionAttribute, setTransactionTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.frankframework.core.INamedObject
getName
Methods inherited from interface org.frankframework.core.IPipe
throwEvent
-
Field Details
-
msgLog
protected org.apache.logging.log4j.Logger msgLog -
PIPE_TIMEOUT_MONITOR_EVENT
- See Also:
-
PIPE_CLEAR_TIMEOUT_MONITOR_EVENT
- See Also:
-
PIPE_EXCEPTION_MONITOR_EVENT
- See Also:
-
MIN_RETRY_INTERVAL
public static final int MIN_RETRY_INTERVAL- See Also:
-
MAX_RETRY_INTERVAL
public static final int MAX_RETRY_INTERVAL- See Also:
-
INPUT_VALIDATOR_NAME_PREFIX
- See Also:
-
INPUT_VALIDATOR_NAME_SUFFIX
- See Also:
-
OUTPUT_VALIDATOR_NAME_PREFIX
- See Also:
-
OUTPUT_VALIDATOR_NAME_SUFFIX
- See Also:
-
INPUT_WRAPPER_NAME_PREFIX
- See Also:
-
INPUT_WRAPPER_NAME_SUFFIX
- See Also:
-
OUTPUT_WRAPPER_NAME_PREFIX
- See Also:
-
OUTPUT_WRAPPER_NAME_SUFFIX
- See Also:
-
MESSAGE_LOG_NAME_PREFIX
- See Also:
-
MESSAGE_LOG_NAME_SUFFIX
- See Also:
-
configurationMetrics
-
-
Constructor Details
-
MessageSendingPipe
public MessageSendingPipe()
-
-
Method Details
-
configure
Description copied from class:FixedForwardPipe
checks for correct configuration of forward- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIPipe
- Overrides:
configure
in classFixedForwardPipe
- Throws:
ConfigurationException
-
propagateName
protected void propagateName() -
setName
Description copied from class:AbstractPipe
The functional name of this pipe. Can be referenced by thepath
attribute of aPipeForward
.- Specified by:
setName
in interfaceINamedObject
- Overrides:
setName
in classAbstractPipe
-
preserve
CallMessage.preserve()
so it can be consumed multiple times, and wrap potentialIOException
in aPipeRunException
.- Parameters:
input
- TheMessage
to be preserved.- Throws:
PipeRunException
- If anIOException
is thrown fromMessage.preserve()
, wrap and rethrow it in aPipeRunException
.
-
doPipe
public PipeRunResult doPipe(@Nonnull Message input, @Nonnull PipeLineSession session) throws PipeRunException Description copied from interface:IPipe
This is where the action takes place. Pipes may only throw a PipeRunException, to be handled by the caller of this object. Implementations must either consume the message, or pass it on to the next Pipe in the PipeRunResult. If the result of the Pipe does not depend on the input, like for theFixedResultPipe
, the Pipe can schedule the input to be closed at session exit, by callingMessage.closeOnCloseOf(PipeLineSession, String)
This allows the previous Pipe to release any resources (e.g. connections) that it might have kept open until the message was consumed. Doing so avoids connections leaking from pools, while it enables efficient streaming processing of data while it is being read from a stream.- Specified by:
doPipe
in interfaceIPipe
- Throws:
PipeRunException
-
sendMessageWithRetries
protected PipeRunResult sendMessageWithRetries(Message input, Message originalMessage, PipeLineSession session) throws IOException, InterruptedException, TransformerException, SAXException, TimeoutException, SenderException, PipeRunException, ListenerException -
postSendAction
protected PipeRunResult postSendAction(PipeRunResult sendResult, String correlationID, PipeLineSession session) throws ListenerException, TimeoutException - Throws:
ListenerException
TimeoutException
-
doLogToMessageLog
protected String doLogToMessageLog(Message input, PipeLineSession session, Message originalMessage, String messageID, String correlationID) throws SenderException - Throws:
SenderException
-
storeMessage
protected final String storeMessage(String messageID, String correlationID, Message messageToStore, String messageTrail, String label) throws SenderException - Throws:
SenderException
-
sendMessage
protected PipeRunResult sendMessage(Message input, PipeLineSession session, ISender sender, Map<String, Object> threadContext) throws SenderException, TimeoutException, InterruptedException, IOException -
increaseRetryIntervalAndWait
public int increaseRetryIntervalAndWait(PipeLineSession session, int retryInterval, String description) throws InterruptedException - Throws:
InterruptedException
-
start
public void start()Description copied from interface:IPipe
Perform necessary action to start the pipe. This method is executed after theIPipe.configure()
method, for each start and stop command of the adapter.- Specified by:
start
in interfaceIPipe
- Overrides:
start
in classAbstractPipe
-
stop
public void stop()Description copied from interface:IPipe
Perform necessary actions to stop thePipe
.
For instance, closing JMS connections, DBMS connections etc.- Specified by:
stop
in interfaceIPipe
- Overrides:
stop
in classAbstractPipe
-
sizeStatisticsEnabled
public boolean sizeStatisticsEnabled()- Specified by:
sizeStatisticsEnabled
in interfaceIPipe
- Overrides:
sizeStatisticsEnabled
in classAbstractPipe
-
consumesSessionVariable
Description copied from interface:IPipe
returnstrue
if the pipe or one of its children use the named session variable. Callers can use this to determine if a message needs to be preserved.- Specified by:
consumesSessionVariable
in interfaceIPipe
- Overrides:
consumesSessionVariable
in classAbstractPipe
-
setSender
The sender that should send the message -
setMessageLog
log of all messages sent -
setInputValidator
specification of Pipe to validate request messages, or request and response message if configured as mixed mode validator -
setOutputValidator
specification of Pipe to validate response messages -
setInputWrapper
specification of Pipe to wrap or unwrap request messages -
setOutputWrapper
specification of Pipe to wrap or unwrap response messages -
setLinkMethod
For asynchronous communication, the server side may either use the messageID or the correlationID in the correlationID field of the reply message. Use this property to set the behaviour of the reply-listener.- Default value
- CORRELATIONID
-
setHideRegex
Next to common usage inAbstractPipe
, also strings in the error/logstore are masked- Specified by:
setHideRegex
in interfaceIPipe
- Overrides:
setHideRegex
in classAbstractPipe
-
setHideMethod
(Only used when hideRegex is not empty and only applies to error/logstore)- Default value
- all
-
setCheckXmlWellFormed
public void setCheckXmlWellFormed(boolean b) If settrue
, the XML Well-Formedness of the result is checked- Default value
- false
-
setCheckRootTag
If set, besides the XML Well-Formedness the root element of the result is checked to be equal to the value set -
setResultOnTimeOut
The message (e.g. 'receiver timed out') that is returned when the time listening for a reply message exceeds the timeout, or in other situations no reply message is received. -
setMaxRetries
public void setMaxRetries(int i) The number of times a processing attempt is retried after a timeout or an exception is caught or after an incorrect reply is received (see alsoretryXPath
)- Default value
- 0
-
setRetryMinInterval
public void setRetryMinInterval(int i) The starting number of seconds waited after an unsuccessful processing attempt before another processing attempt is made. Each next retry this interval is doubled with a upper limit ofretryMaxInterval
- Default value
- 1
-
setRetryMaxInterval
public void setRetryMaxInterval(int i) The maximum number of seconds waited after an unsuccessful processing attempt before another processing attempt is made- Default value
- 600
-
setRetryXPath
XPath expression evaluated on each technical successful reply. Retry is done if condition returns true -
setRetryNamespaceDefs
Namespace defintions for retryXPath. Must be in the form of a comma or space separated list ofprefix=namespaceUri
-definitions -
setPresumedTimeOutInterval
public void setPresumedTimeOutInterval(int i) If the previous call was a timeout, the maximum time in seconds after this timeout to presume the current call is also a timeout.- Default value
- 0
-
setStubFilename
If set, the pipe returns a message from a file, instead of doing the regular process -
setTimeoutOnResult
If not empty, a TimeoutException is thrown when the result equals this value (for testing purposes only) -
setTimeOutOnResult
@Deprecated(since="8.1") @ConfigurationWarning("Use attribute timeoutOnResult instead") public void setTimeOutOnResult(String string) Deprecated.usesetTimeoutOnResult(String)
insteadIf not empty, a TimeoutException is thrown when the result equals this value (for testing purposes only) -
setExceptionOnResult
If not empty, a PipeRunException is thrown when the result equals this value (for testing purposes only) -
getLinkMethod
-
getHideMethod
-
isCheckXmlWellFormed
public boolean isCheckXmlWellFormed() -
getCheckRootTag
-
getResultOnTimeOut
-
getMaxRetries
public int getMaxRetries() -
getRetryMinInterval
public int getRetryMinInterval() -
getRetryMaxInterval
public int getRetryMaxInterval() -
getRetryXPath
-
getRetryNamespaceDefs
-
getPresumedTimeOutInterval
public int getPresumedTimeOutInterval() -
getStubFilename
-
getTimeoutOnResult
-
getExceptionOnResult
-
getSender
-
getMessageLog
-
getInputValidator
-
getOutputValidator
-
getInputWrapper
-
getOutputWrapper
-
setPipeProcessor
-
setConfigurationMetrics
-
getConfigurationMetrics
-
setTimeoutOnResult(String)
instead