Broadcast conf AMQP app

This commit is contained in:
YuCheng Hu 2019-10-13 02:12:55 -04:00
parent 796d402f67
commit 5dd4ee6f0f
2 changed files with 8 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package com.baeldung.springamqp.broadcast; package com.ossez.springamqp.broadcast;
import org.springframework.amqp.core.*; import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -1,4 +1,4 @@
package com.baeldung.springamqp.broadcast; package com.ossez.springamqp.broadcast;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
@ -7,8 +7,6 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import static com.baeldung.springamqp.broadcast.BroadcastConfig.*;
/** /**
* Simple test application to send messages to rabbitMQ. * Simple test application to send messages to rabbitMQ.
* *
@ -37,23 +35,23 @@ public class BroadcastMessageApp {
}; };
} }
@RabbitListener(queues = { FANOUT_QUEUE_1_NAME }) @RabbitListener(queues = { BroadcastConfig.FANOUT_QUEUE_1_NAME })
public void receiveMessageFromFanout1(String message) { public void receiveMessageFromFanout1(String message) {
System.out.println("Received fanout 1 message: " + message); System.out.println("Received fanout 1 message: " + message);
} }
@RabbitListener(queues = { FANOUT_QUEUE_2_NAME }) @RabbitListener(queues = { BroadcastConfig.FANOUT_QUEUE_2_NAME })
public void receiveMessageFromFanout2(String message) { public void receiveMessageFromFanout2(String message) {
System.out.println("Received fanout 2 message: " + message); System.out.println("Received fanout 2 message: " + message);
} }
@RabbitListener(queues = { TOPIC_QUEUE_1_NAME }) @RabbitListener(queues = { BroadcastConfig.TOPIC_QUEUE_1_NAME })
public void receiveMessageFromTopic1(String message) { public void receiveMessageFromTopic1(String message) {
System.out.println("Received topic 1 (" + BINDING_PATTERN_IMPORTANT + ") message: " + message); System.out.println("Received topic 1 (" + BroadcastConfig.BINDING_PATTERN_IMPORTANT + ") message: " + message);
} }
@RabbitListener(queues = { TOPIC_QUEUE_2_NAME }) @RabbitListener(queues = { BroadcastConfig.TOPIC_QUEUE_2_NAME })
public void receiveMessageFromTopic2(String message) { public void receiveMessageFromTopic2(String message) {
System.out.println("Received topic 2 (" + BINDING_PATTERN_ERROR + ") message: " + message); System.out.println("Received topic 2 (" + BroadcastConfig.BINDING_PATTERN_ERROR + ") message: " + message);
} }
} }