roborative roborative - 1 year ago 83
JSON Question

Is there a way to default to JSON serialization with Spring Integration?

I'm using Spring Integration with AMQP-backed messages and I'd prefer to use JSON instead of the default Java serialization for messages. This preference is due in part to serialization exceptions encountered when using Kotlin objects.

While researching the issue, I came across this post:

Spring integration - AMQP backed message channels and message conversion

So it seems the ability to use JSON serialization with AMQP-backed messages has only recently been supported. Moreover, I believe Spring Cloud Stream project provides support for this approach out-of-the-box but I haven't been able to figure out how to achieve something similar with SI.

I came across a post that provides a means to do this channel-by-channel but it seems tedious to configure it this way for each channel when I really just want to use it across the board.

Answer Source

Is there something preventing you from upgrading to 4.3?

<int-amqp:channel id="withEP" 
    extract-payload="true" message-converter="jackson" />

There's currently no way to globally set options for all channels of a particular type.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download