By Admin on Wednesday, 29 December 2021
Category: All

AMQP Receive Messages (3 / 3)

AMQP allows to receive the messages in 2 modes:

Consume 

Consumers consume from queues. In order to consume messages there has to be a queue. When a new consumer is added, assuming there are already messages ready in the queue, deliveries will start immediately.

The target queue can be empty at the time of consumer registration. In that case first deliveries will happen when new messages are enqueued.

Consuming messages is an asynchronous task, which means that every time a new message can be delivered to the consumer queue, it's pushed by the server to the client automatically. You can read an alternative method to Receive Message Synchronously.

The method Consume creates a new consumer in the queue, and every time there is a new message this will be delivered automatically to the consumer client.

The method has the following arguments:


The messages are delivered OnAMQPBasigGetOk event.

Get Messages 

Getting messages is a Synchronous task, which means that is the client who ask to server is there are messages in the queue. You can read an alternative method to Receive Message Aynchronously.

The method GetMessage sends a request to the AMQP server asking if there are messages available in a queue. If there are messages these will be dispatched OnAMQPBasicGetOk event and if the queue is empty, the event OnAMQPBasicGetEmpty will be called.

The method has the following arguments:

Related Posts