Class ChannelMessageStorePreparedStatementSetter
java.lang.Object
org.springframework.integration.jdbc.store.channel.ChannelMessageStorePreparedStatementSetter
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 Summary
ModifierConstructorDescriptionprotected
The default constructor for inheritors who are not interested in the message serialization tobyte[]
.ChannelMessageStorePreparedStatementSetter
(SerializingConverter serializer, LobHandler lobHandler) Instantiate aChannelMessageStorePreparedStatementSetter
with the provided serializer and lobHandler, which both must not be null. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setValues
(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) Perform a preparedStatement parameters population according provided arguments.
-
Constructor Details
-
ChannelMessageStorePreparedStatementSetter
public ChannelMessageStorePreparedStatementSetter(SerializingConverter serializer, LobHandler lobHandler) Instantiate aChannelMessageStorePreparedStatementSetter
with the provided serializer and lobHandler, which both must not be null.- Parameters:
serializer
- theSerializingConverter
to buildbyte[]
from the request messagelobHandler
- theLobHandler
to storebyte[]
of the request message to prepared statement
-
ChannelMessageStorePreparedStatementSetter
protected ChannelMessageStorePreparedStatementSetter()The default constructor for inheritors who are not interested in the message serialization tobyte[]
. Theserializer
andlobHandler
are null from 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
serializer
andlobHandler
are provided.
- Parameters:
preparedStatement
- thePreparedStatement
to populate columns based on the provided argumentsrequestMessage
- theMessage
to storegroupId
- the group id for the message to storeregion
- the region in the target table to distinguish different data base clientspriorityEnabled
- the flag to indicate if priority has to be stored- Throws:
SQLException
- the exception throws during data population
-