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
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
ModifierConstructorDescriptionprotected
The default constructor for inheritors who are not interested in the message serialization tobyte[]
.Instantiate aChannelMessageStorePreparedStatementSetter
with the provided serializer and lobHandler, which both must not be null.ChannelMessageStorePreparedStatementSetter
(SerializingConverter serializer, LobHandler lobHandler) Deprecated, for removal: This API element is subject to removal in a future version. -
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
@Deprecated(forRemoval=true, since="6.4") public ChannelMessageStorePreparedStatementSetter(SerializingConverter serializer, LobHandler lobHandler) Deprecated, for removal: This API element is subject to removal in a future version.since 6.4 (for removal) (if favor ofChannelMessageStorePreparedStatementSetter(SerializingConverter)
) with a plain JDBC driver support for byte arrays.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
Instantiate aChannelMessageStorePreparedStatementSetter
with the provided serializer and lobHandler, which both must not be null.- Parameters:
serializer
- theSerializingConverter
to 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[]
. Theserializer
isnull
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
is 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 database clientspriorityEnabled
- the flag to indicate if priority has to be stored- Throws:
SQLException
- the exception throws during data population
-
ChannelMessageStorePreparedStatementSetter(SerializingConverter)
) with a plain JDBC driver support for byte arrays.