how can spring integration 5.5.x use mysql as message store

237 views Asked by At

I'm using Mysql as message store DB, just tried to upgrade to spring integration 5.5.5, but found the schema changed, there requires a CONDITION column in INT_MESSAGE_GROUP table, although I can create the table by adding backtick around CONDITION, there is a sql in JdbcMessageStore.java

    GET_GROUP_INFO("SELECT COMPLETE, LAST_RELEASED_SEQUENCE, CREATED_DATE, UPDATED_DATE, CONDITION" +
            " from %PREFIX%MESSAGE_GROUP where GROUP_KEY=? and REGION=?")

it cannot work? any work-around?

1

There are 1 answers

1
Artem Bilan On BEST ANSWER

Yes, I see now. Looks like condition is a reserved word in MySQL: Is condition considered a special word in mySQL?. Not sure how I have missed that, but this is considered as a bug and have to be really fixed from the framework perspective.

The workaround depend on the fact what you are doing with that JdbcMessageStore. If you use it from the queue channel, then it is better to look into a JdbcChannelMessageStore instead: https://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-message-store-channels.

If you really deal with an aggregator, then you have to extend JdbcMessageStore and override getGroupMetadata() and setGroupCondition() where a CONDITION is in use for SQL statements.

Or just look into some other DB vendor which doesn't reserve CONDITION word!

I'm going to fix it via GROUP_CONDITION word instead...

UPDATE

The fix for the framework code is here: https://github.com/spring-projects/spring-integration/pull/3687. The next Spring Integration 5.5.7 will be released like this: https://github.com/spring-projects/spring-integration/milestone/80. Just in time for the next Spring Boot versions!