Today we will create a new project (Consumer) and write to log messages coming from RabbitMQ (Producer).
I created a new project in EndlessHope, its name is Consumer and I did default config like Producer.
We always need a connection since we can get a message anytime. Therefore, we do not close connections.
We have only one block different from the Producer.
DeliverCallback deliverCallback = (String c, Delivery delivery) -> { logger.info(new String(delivery.getBody(), "UTF-8")); }; channel.basicConsume(rabbitmqQueuename, true, deliverCallback, consumerTag -> { });
I know these post are quite short because I’m learning, and I try to write a post often both for my blog and also for you.
You can check all code here.
https://gitlab.com/sercantogrul/endless-hope