Class ChannelMessageStorePreparedStatementSetter

java.lang.Object
org.springframework.integration.jdbc.store.channel.ChannelMessageStorePreparedStatementSetter

public class ChannelMessageStorePreparedStatementSetter extends Object
Callback to be used with the JdbcChannelMessageStore.

Behavior is same as standard PreparedStatementSetter, it takes in additional Message<?> requestMessage, Object groupId, String region and boolean priorityEnabled parameters used for addMessageToGroup method in the JdbcChannelMessageStore.

This class can be extended for any custom data structure or columns types. For this purpose the protected constructor is provided for inheritors. In this case the serializer and lobHandler are null to avoid extra serialization actions if the target custom behavior doesn't imply them.

Since:
5.0
Author:
Meherzad Lahewala, Artem Bilan
See Also:
  • Constructor Details

  • Method Details

    • setValues

      public void setValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) throws SQLException
      Perform a preparedStatement parameters population according provided arguments. The default functionality is (parameter - data):
      • 1 - messageId
      • 2 - groupKey
      • 3 - region
      • 4 - createdDate
      • 5 - priority if enabled, otherwise null
      • 6 - serialized message if serializer and lobHandler are provided.
      An inheritor may consider to call this method for population common properties and perform custom message serialization logic for the parameter #6. Any custom data structure population can be achieved with full overriding of this method.
      Parameters:
      preparedStatement - the PreparedStatement to populate columns based on the provided arguments
      requestMessage - the Message to store
      groupId - the group id for the message to store
      region - the region in the target table to distinguish different data base clients
      priorityEnabled - the flag to indicate if priority has to be stored
      Throws:
      SQLException - the exception throws during data population