Search code examples
springjdbcintegrationactivemq-classicserializable

Spring integration message handler : ActiveMQTextMessage


I'm facing a problem using a jdbc-store in a spring-int aggregator component.

My flow is like this :

ActiveMQ -> aggregator -> jdbc-message-store -> ftp

But on handling the messages, i'm facing a java.io.NotSerializableException, as ActiveMQTextMessage is not serializable.

As i was using a simpleMessageStore ( in memory ), this solution was working, but i can't get it to work right now.

Do i need to create my own implementation of MessageHandler to convert the ActiveMQTextMessage to a proper Serializable Message , or am i doing something wrong ?

Thanks.

<int-jms:message-driven-channel-adapter id="inputQueueAdapter" 
                        channel="mqChannel"
                        max-concurrent-consumers="3" 
                        cache-level="3"
                        extract-payload="true"
                        connection-factory="jmsConnectionFactory"
                        destination-name="test.xdr.queue"/>


<int:aggregator         id="XDRAggegator"
                        ref="xdrAggregator"
                        input-channel="mqChannel"
                        output-channel="publishChannel"
                        message-store="jdbc-messageStore"
                />

<int-jdbc:message-store id="jdbc-messageStore" data-source="dataSource"  />

Solution

  • Are you sure you have extract-payload="true" as shown here?

    When this is false, the JMS message itself is the payload whereas when true, it is converted using a message converter (e.g. JmsTextMessage is converted to String).

    Turn on DEBUG logging and examine the payload of the message in mqChannel.