Update Recv.java

StandardCharsets.UTF_8 used instead of String value
This commit is contained in:
Andrii Maliuta 2021-11-01 13:02:15 +02:00 committed by GitHub
parent c033948093
commit c503a3ad25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ public class Recv {
System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
DeliverCallback deliverCallback = (consumerTag, delivery) -> {
String message = new String(delivery.getBody(), "UTF-8");
String message = new String(delivery.getBody(), StandardCharsets.UTF_8);
System.out.println(" [x] Received '" + message + "'");
};
channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> { });