private static class JacksonMessageStorePreparedStatementSetter extends ChannelMessageStorePreparedStatementSetter { (1)
private final ObjectMapper objectMapper;
public JacksonMessageStorePreparedStatementSetter(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public void setValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region,
boolean priorityEnabled) throws SQLException {
super.setValues(preparedStatement, requestMessage, groupId, region, priorityEnabled);
try {
String json = objectMapper.writeValueAsString(requestMessage); (2)
preparedStatement.setObject(6, json, java.sql.Types.OTHER); (3)
} catch (JsonProcessingException e) {
throw new RuntimeException("Unable to store message", e);
}
}
}