Class JdbcTableListener<M>

All Implemented Interfaces:
HasPhysicalDestination, IConfigurable, IConfigurationAware, IHasProcessState<M>, IListener<M>, INamedObject, IPeekableListener<M>, IProvidesMessageBrowsers<M>, IPullingListener<M>, IScopeProvider, IXAEnabled, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
MessageStoreListener

public class JdbcTableListener<M> extends JdbcListener<M> implements IProvidesMessageBrowsers<M>
Database Listener that operates on a table having at least a key and a status field.
Since:
4.7
  • Constructor Details

    • JdbcTableListener

      public JdbcTableListener()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IListener
      configure() is called once at startup of the framework in the configure() method of the owner of this listener. Purpose of this method is to reduce creating connections to databases etc. in the IPullingListener.getRawMessage(Map) method. As much as possible class-instantiating should take place in the configure() or IListener.start() method, to improve performance.
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IListener<M>
      Overrides:
      configure in class JdbcListener<M>
      Throws:
      ConfigurationException
    • verifyFieldNotInQuery

      protected void verifyFieldNotInQuery(String fieldName, String query)
    • createUpdateStatusQuery

      protected String createUpdateStatusQuery(String fieldValue, String additionalSetClause)
    • changeProcessState

      protected RawMessageWrapper<M> changeProcessState(Connection connection, RawMessageWrapper<M> rawMessage, ProcessState toState, String reason) throws ListenerException
      Overrides:
      changeProcessState in class JdbcListener<M>
      Throws:
      ListenerException
    • getMessageBrowser

      public IMessageBrowser<M> getMessageBrowser(ProcessState state)
      Description copied from interface: IProvidesMessageBrowsers
      returns a browser of messages that are in ProcessState 'state', and are stored in a storage managed by the listener itself (as opposed to a storage configured as a messageLog or errorStorage in the configuration).
      Specified by:
      getMessageBrowser in interface IProvidesMessageBrowsers<M>
    • getStatusValue

      public String getStatusValue(ProcessState state)
    • getStorageType

      public IMessageBrowser.StorageType getStorageType(ProcessState state)
    • getPhysicalDestinationName

      public String getPhysicalDestinationName()
      Description copied from class: JdbcFacade
      Returns the name and location of the database that this objects operates on. If no previous connection was made or it cannot determine the destination it returns 'unknown'
      Specified by:
      getPhysicalDestinationName in interface HasPhysicalDestination
      Overrides:
      getPhysicalDestinationName in class JdbcFacade
      See Also:
    • setTableName

      public void setTableName(String string)
      Name of the table to be used
    • setTableAlias

      public void setTableAlias(String string)
      Alias of the table, that can be used in selectCondition
      Default value
      t
    • setStatusField

      public void setStatusField(String fieldname)
      Field containing the status of the message. NB: For optimal performance, an index should exist that starts with this field, followed by all fields that are used with a fixed value in the select condition, and end with the orderField.
    • setOrderField

      public void setOrderField(String string)
      (optional) Comma separated list of fields determining the order in which messages are processed
    • setTimestampField

      public void setTimestampField(String fieldname)
      (optional) Field used to store the date and time of the last change of the statusField
    • setCommentField

      public void setCommentField(String commentField)
      (optional) Field used to store the reason of the last change of the statusField
    • setMaxCommentLength

      public void setMaxCommentLength(int maxCommentLength)
      (optional) Maximum length of strings to be stored in commentField, or -1 for unlimited
      Default value
      1000
    • setStatusValueAvailable

      public void setStatusValueAvailable(String string)
      (optional) Value of statusField indicating row is available to be processed. If not specified, any row not having any of the other status values is considered available.
    • setStatusValueError

      public void setStatusValueError(String string)
      Value of statusField indicating the processing of the row resulted in an error
    • setStatusValueProcessed

      public void setStatusValueProcessed(String string)
      Value of status field indicating row is processed OK
    • setStatusValueInProcess

      public void setStatusValueInProcess(String string)
      Value of statusField indicating is being processed. Can be left emtpy if database has SKIP LOCKED functionality and the transactionAttribute of the Receiver can be (and is) set to Required or RequiresNew.
    • setStatusValueHold

      public void setStatusValueHold(String string)
      Value of statusField indicating message is on Hold, temporarily
    • setSelectCondition

      public void setSelectCondition(String string)
      Additional condition for a row to belong to this TableListener. Impacts all process states
    • getTableName

      public String getTableName()
    • getTableAlias

      public String getTableAlias()
    • getStatusField

      public String getStatusField()
    • getOrderField

      public String getOrderField()
    • getTimestampField

      public String getTimestampField()
    • getCommentField

      public String getCommentField()
    • getSelectCondition

      public String getSelectCondition()
    • getMaxCommentLength

      public int getMaxCommentLength()