Skip to content

Instantly share code, notes, and snippets.

@chathurangat
Last active November 8, 2017 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chathurangat/2321201d8fa8c6745e442cce2256a9dd to your computer and use it in GitHub Desktop.
Save chathurangat/2321201d8fa8c6745e442cce2256a9dd to your computer and use it in GitHub Desktop.
package com.springbootdev.samples.producer;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitMqConfig
{
@Bean
public MessageConverter jsonMessageConverter()
{
return new Jackson2JsonMessageConverter();
}
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory)
{
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setMessageConverter(jsonMessageConverter());
return template;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment