Class 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.
  • Field Details

  • Constructor Details

    • MessageSendingPipe

      public MessageSendingPipe()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: FixedForwardPipe
      checks for correct configuration of forward
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IPipe
      Overrides:
      configure in class FixedForwardPipe
      Throws:
      ConfigurationException
    • propagateName

      protected void propagateName()
    • setName

      public void setName(String name)
      Description copied from class: AbstractPipe
      The functional name of this pipe. Can be referenced by the path attribute of a PipeForward.
      Specified by:
      setName in interface INamedObject
      Overrides:
      setName in class AbstractPipe
    • preserve

      protected void preserve(@Nonnull Message input) throws PipeRunException
      Call Message.preserve() so it can be consumed multiple times, and wrap potential IOException in a PipeRunException.
      Parameters:
      input - The Message to be preserved.
      Throws:
      PipeRunException - If an IOException is thrown from Message.preserve(), wrap and rethrow it in a PipeRunException.
    • 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 the FixedResultPipe, the Pipe can schedule the input to be closed at session exit, by calling Message.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 interface IPipe
      Throws:
      PipeRunException
    • sendMessageWithRetries

      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
      Throws:
      SenderException
      TimeoutException
      InterruptedException
      IOException
    • increaseRetryIntervalAndWait

      public int increaseRetryIntervalAndWait(PipeLineSession session, int retryInterval, String description) throws InterruptedException
      Throws:
      InterruptedException
    • start

      public void start() throws PipeStartException
      Description copied from interface: IPipe
      Perform necessary action to start the pipe. This method is executed after the IPipe.configure() method, for each start and stop command of the adapter.
      Specified by:
      start in interface IPipe
      Overrides:
      start in class AbstractPipe
      Throws:
      PipeStartException
    • stop

      public void stop()
      Description copied from interface: IPipe
      Perform necessary actions to stop the Pipe.
      For instance, closing JMS connections, DBMS connections etc.
      Specified by:
      stop in interface IPipe
      Overrides:
      stop in class AbstractPipe
    • sizeStatisticsEnabled

      public boolean sizeStatisticsEnabled()
      Specified by:
      sizeStatisticsEnabled in interface IPipe
      Overrides:
      sizeStatisticsEnabled in class AbstractPipe
    • consumesSessionVariable

      public boolean consumesSessionVariable(String sessionKey)
      Description copied from interface: IPipe
      returns true 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 interface IPipe
      Overrides:
      consumesSessionVariable in class AbstractPipe
    • setSender

      protected void setSender(ISender sender)
      The sender that should send the message
    • setMessageLog

      public void setMessageLog(ITransactionalStorage<?> messageLog)
      log of all messages sent
    • setInputValidator

      public void setInputValidator(IValidator inputValidator)
      specification of Pipe to validate request messages, or request and response message if configured as mixed mode validator
    • setOutputValidator

      public void setOutputValidator(IValidator outputValidator)
      specification of Pipe to validate response messages
    • setInputWrapper

      public void setInputWrapper(IWrapperPipe inputWrapper)
      specification of Pipe to wrap or unwrap request messages
    • setOutputWrapper

      public void setOutputWrapper(IWrapperPipe outputWrapper)
      specification of Pipe to wrap or unwrap response messages
    • setLinkMethod

      public void setLinkMethod(MessageSendingPipe.LinkMethod method)
      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

      public void setHideRegex(String hideRegex)
      Next to common usage in AbstractPipe, also strings in the error/logstore are masked
      Specified by:
      setHideRegex in interface IPipe
      Overrides:
      setHideRegex in class AbstractPipe
    • setHideMethod

      public void setHideMethod(IMessageBrowser.HideMethod hideMethod)
      (Only used when hideRegex is not empty and only applies to error/logstore)
      Default value
      all
    • setCheckXmlWellFormed

      public void setCheckXmlWellFormed(boolean b)
      If set true, the XML Well-Formedness of the result is checked
      Default value
      false
    • setCheckRootTag

      public void setCheckRootTag(String s)
      If set, besides the XML Well-Formedness the root element of the result is checked to be equal to the value set
    • setResultOnTimeOut

      public void setResultOnTimeOut(String newResultOnTimeOut)
      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 also retryXPath)
      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 of retryMaxInterval
      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

      public void setRetryXPath(String string)
      XPath expression evaluated on each technical successful reply. Retry is done if condition returns true
    • setRetryNamespaceDefs

      public void setRetryNamespaceDefs(String retryNamespaceDefs)
      Namespace defintions for retryXPath. Must be in the form of a comma or space separated list of prefix=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

      public void setStubFilename(String filename)
      If set, the pipe returns a message from a file, instead of doing the regular process
    • setTimeoutOnResult

      public void setTimeoutOnResult(String string)
      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.
      If not empty, a TimeoutException is thrown when the result equals this value (for testing purposes only)
    • setExceptionOnResult

      public void setExceptionOnResult(String string)
      If not empty, a PipeRunException is thrown when the result equals this value (for testing purposes only)
    • getLinkMethod

      public MessageSendingPipe.LinkMethod getLinkMethod()
    • getHideMethod

      public IMessageBrowser.HideMethod getHideMethod()
    • isCheckXmlWellFormed

      public boolean isCheckXmlWellFormed()
    • getCheckRootTag

      public String getCheckRootTag()
    • getResultOnTimeOut

      public String getResultOnTimeOut()
    • getMaxRetries

      public int getMaxRetries()
    • getRetryMinInterval

      public int getRetryMinInterval()
    • getRetryMaxInterval

      public int getRetryMaxInterval()
    • getRetryXPath

      public String getRetryXPath()
    • getRetryNamespaceDefs

      public String getRetryNamespaceDefs()
    • getPresumedTimeOutInterval

      public int getPresumedTimeOutInterval()
    • getStubFilename

      public String getStubFilename()
    • getTimeoutOnResult

      public String getTimeoutOnResult()
    • getExceptionOnResult

      public String getExceptionOnResult()
    • getSender

      public ISender getSender()
      Specified by:
      getSender in interface HasSender
    • getMessageLog

      public ITransactionalStorage getMessageLog()
    • getInputValidator

      public IValidator getInputValidator()
    • getOutputValidator

      public IValidator getOutputValidator()
    • getInputWrapper

      public IWrapperPipe getInputWrapper()
    • getOutputWrapper

      public IWrapperPipe getOutputWrapper()
    • setPipeProcessor

      public void setPipeProcessor(PipeProcessor pipeProcessor)
    • setConfigurationMetrics

      public void setConfigurationMetrics(MetricsInitializer configurationMetrics)
    • getConfigurationMetrics

      public MetricsInitializer getConfigurationMetrics()