Created
July 31, 2020 14:33
-
-
Save sophea/346df5b23116c6bbd99a0760919aa35e to your computer and use it in GitHub Desktop.
RabbitMQDirectConfigExchangeType.java
This file contains hidden or 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.sma.rabbitmq.config; | |
| import org.springframework.amqp.core.Binding; | |
| import org.springframework.amqp.core.BindingBuilder; | |
| import org.springframework.amqp.core.DirectExchange; | |
| import org.springframework.amqp.core.Queue; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| /** | |
| * Author: Mak Sophea | |
| * Date: 07/31/2020 | |
| */ | |
| @Configuration | |
| public class RabbitMQDirectConfigExchangeType { | |
| @Bean | |
| Queue marketingQueue() { | |
| return new Queue("marketingQueue", false); | |
| } | |
| @Bean | |
| Queue financeQueue() { | |
| return new Queue("financeQueue", false); | |
| } | |
| @Bean | |
| Queue adminQueue() { | |
| return new Queue("adminQueue", false); | |
| } | |
| @Bean | |
| DirectExchange directExchange() { | |
| return new DirectExchange("direct-exchange"); | |
| } | |
| @Bean | |
| Binding marketingBinding(Queue marketingQueue, DirectExchange directExchange) { | |
| return BindingBuilder.bind(marketingQueue).to(directExchange).with("marketing"); | |
| } | |
| @Bean | |
| Binding financeBinding(Queue financeQueue, DirectExchange directExchange) { | |
| return BindingBuilder.bind(financeQueue).to(directExchange).with("finance"); | |
| } | |
| @Bean | |
| Binding adminBinding(Queue adminQueue, DirectExchange directExchange) { | |
| return BindingBuilder.bind(adminQueue).to(directExchange).with("admin"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment