Вывод сообщения о том, что очередь не принимает сообщения
This commit is contained in:
@@ -20,12 +20,17 @@ public class Send {
|
|||||||
try (Connection connection = factory.newConnection();
|
try (Connection connection = factory.newConnection();
|
||||||
Channel channel = connection.createChannel()) {
|
Channel channel = connection.createChannel()) {
|
||||||
channel.queueDeclarePassive(QUEUE_NAME);
|
channel.queueDeclarePassive(QUEUE_NAME);
|
||||||
|
channel.confirmSelect();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
String message = "Message from " + name + " #" + count++;
|
String message = "Message from " + name + " #" + count++;
|
||||||
channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
|
channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
|
||||||
System.out.println(" [x] Sent '" + message + "'");
|
if (!channel.waitForConfirms()) {
|
||||||
|
System.out.println(" [!] Message was NOT confirmed!");
|
||||||
|
} else {
|
||||||
|
System.out.println(" [x] Sent '" + message + "'");
|
||||||
|
}
|
||||||
Thread.sleep(delay);
|
Thread.sleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user