Created
November 12, 2017 08:50
-
-
Save chathurangat/17f0dff8b4b30b796b0f6c33e3075452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.springbootdev.examples.producer.config; | |
import org.springframework.amqp.rabbit.connection.ConnectionFactory; | |
import org.springframework.amqp.rabbit.core.RabbitTemplate; | |
import org.springframework.amqp.support.converter.*; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
public class RabbitMqConfig | |
{ | |
@Bean | |
public MessageConverter messageConverter() | |
{ | |
return new Jackson2JsonMessageConverter(); | |
} | |
@Bean | |
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { | |
RabbitTemplate template = new RabbitTemplate(connectionFactory); | |
template.setMessageConverter(messageConverter()); | |
return template; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment