Configuring a message converter

At the precise time a message is received by the listener, two change steps happen. In the initial step, the incoming AMQP message is changed over to a Spring messaging Message using MessageConverter. In the second step, when the target method is executed, the payload of the message is changed over to the parameter type if necessary. By default, in the initial step, MessageConverter is utilized as Spring AMQP SimpleMessageConverter that handles the transformation to String and java.io.Serializable.

In the second step, by default, GenericMessageConverter is used for conversion. We have used Jackson2JsonMessageConverter in the following code:

@Bean
public MessageConverter messageConverter() {
return new Jackson2JsonMessageConverter();
}

We will use this message converter as a property to change the default message converter while configuring a RabbitTemplate in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset