Class ChannelMessageStorePreparedStatementSetter
java.lang.Object
org.springframework.integration.jdbc.store.channel.ChannelMessageStorePreparedStatementSetter
- Direct Known Subclasses:
JsonChannelMessageStorePreparedStatementSetter
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 is 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 Summary
ConstructorsModifierConstructorDescriptionprotectedThe default constructor for inheritors who are not interested in the message serialization tobyte[].Instantiate aChannelMessageStorePreparedStatementSetterwith the provided serializer and lobHandler, which both must not be null. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) Perform a preparedStatement parameters population according provided arguments.
-
Constructor Details
-
ChannelMessageStorePreparedStatementSetter
Instantiate aChannelMessageStorePreparedStatementSetterwith the provided serializer and lobHandler, which both must not be null.- Parameters:
serializer- theSerializingConverterto buildbyte[]from the request message- Since:
- 6.4
-
ChannelMessageStorePreparedStatementSetter
protected ChannelMessageStorePreparedStatementSetter()The default constructor for inheritors who are not interested in the message serialization tobyte[]. Theserializerisnullfrom this constructor, therefore any serialization isn't happened in the defaultsetValues(java.sql.PreparedStatement, org.springframework.messaging.Message<?>, java.lang.Object, java.lang.String, boolean)implementation. A target implementor must ensure the proper custom logic for storing message.
-
-
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
serializeris provided.
- Parameters:
preparedStatement- thePreparedStatementto populate columns based on the provided argumentsrequestMessage- theMessageto storegroupId- the group id for the message to storeregion- the region in the target table to distinguish different database clientspriorityEnabled- the flag to indicate if priority has to be stored- Throws:
SQLException- the exception throws during data population
-