Class MessageStoreSender

All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, HasPhysicalDestination, IConfigurable, IMessageBrowser<Serializable>, IScopeProvider, ISender, ISenderWithParameters, ITransactionalStorage, IWithParameters, IXAEnabled, NameAware, ConfigurableLifecycle, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

@ExcludeFromType(ITransactionalStorage.class) public class MessageStoreSender extends JdbcTransactionalStorage implements ISenderWithParameters
Send messages to the IBISSTORE database table to have them processed exactly-once by another adapter which will read the messages using a MessageStoreListener. This other adapter will process the messages asynchronously and (optionally) under transaction control. Duplicate messages are ignored based on the messageId (except when onlyStoreWhenMessageIdUnique is set to false), hence the sender of the message can retry sending the message until a valid reply is received in which case it can be certain that the message is stored in the database table IBISSTORE.

If you have a MessageStoreSender it does not make sense to add a JdbcMessageLog or JdbcErrorStorage in the same sender pipe. A MessageStoreSender acts as a message log and an error store. It can be useful however to add a message log or error store to the adapter around the sender pipe, because errors may occur before the message reaches the sender pipe.

Example configuration:
<SenderPipe name="Send">
    <MessageStoreSender
	     slotId="${instance.name}/TestMessageStore"
		 onlyStoreWhenMessageIdUnique="false" />
</SenderPipe>
Author:
Jaco de Groot
Specific parameters
messageId messageId to check for duplicates, when this parameter isn't present the messageId is read from sessionKey messageId, correlationId correlationId to check for duplicates, when this parameter isn't present the correlationId is read from sessionKey correlationId
  • Constructor Details

    • MessageStoreSender

      public MessageStoreSender()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: JdbcTransactionalStorage
      Creates a connection, checks if the necessary tables, indices and sequences exist.
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface ITransactionalStorage
      Overrides:
      configure in class JdbcTransactionalStorage
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • isSynchronous

      public boolean isSynchronous()
      Description copied from interface: ISender
      When true, the result of sendMessage is the reply of the request.
      Specified by:
      isSynchronous in interface ISender
    • addParameter

      public void addParameter(IParameter p)
      Specified by:
      addParameter in interface IWithParameters
    • getParameterList

      public @NonNull ParameterList getParameterList()
      Specified by:
      getParameterList in interface IWithParameters
    • sendMessage

      public @NonNull SenderResult sendMessage(@NonNull Message message, @NonNull PipeLineSession session) throws SenderException
      Description copied from interface: ISender
      Send a message to some destination (as configured in the Sender object). This method may only be called after the configure() method is called.

      The following table shows the difference between synchronous and a-synchronous senders:

       synchronousa-synchronous
      ISender.isSynchronous() returnstruefalse
      return value of sendMessage() isthe reply-messagethe messageId of the message sent
      the correlationID specified with sendMessage()may be ignoredis sent with the message
      a {link TimeOutException}may be thrown if a timeout occurs waiting for a replyshould not be expected

      Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or synchronized.

      Specified by:
      sendMessage in interface ISender
      Throws:
      SenderException
    • setSessionKeys

      public void setSessionKeys(String sessionKeys)
      Comma separated list of sessionKey's to be stored together with the message. Please note: corresponding MessageStoreListener must have the same value for this attribute.
    • setOnlyStoreWhenMessageIdUnique

      public void setOnlyStoreWhenMessageIdUnique(boolean onlyStoreWhenMessageIdUnique)
      If set to true, the message is stored only if the MessageId is not present in the store yet.
      Overrides:
      setOnlyStoreWhenMessageIdUnique in class JdbcTransactionalStorage
      Default value
      true
    • setSlotId

      @Mandatory public void setSlotId(String string)
      Set the slotId, an identifier to keep separate the messages inserted by different MessageStoreSenders.
      This field should be set.
      Specified by:
      setSlotId in interface ITransactionalStorage
      Overrides:
      setSlotId in class JdbcTransactionalStorage
      Parameters:
      string - The slotID value for this MessageStoreSender.