Rabbitmq amqp - listening to messages from consumers

I have a producer and broker on the same machine. The manufacturer sends the following messages:

channel = connection.createChannel();

//Create a durable queue (if not already present)
channel.queueDeclare(merchantId, true, false, false, null);

//Publish message onto the queue
channel.basicPublish("", consumerId, true, false,
    MessageProperties.MINIMAL_PERSISTENT_BASIC, "myMessage");

The user is sitting on another machine and listening to messages. It uses explicit confirmation like this:

while (true) {
    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
    //Handle message here  
    channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
}   

From what I understand, ack is for the broker to delete the message.

But how does my producer find out what the consumer sent?

+4
source share
1 answer

. AMQP. , , . , - , . AMQP ( ), , , AMQP.

- RPC, -, , ( RabbitMQ - , RPC RabbtiMQ).

, , , (aka Publisher ) " " , , .

+3

Source: https://habr.com/ru/post/1568390/


All Articles