AMQP basic.get simultaneous consumers pulling out of line

When using RabbitMQ as a Message Broker, I have a scenario where multiple concurrent users retrieve messages from a queue using the basic.get AMQP method and use explicit acknowledgment to remove a message from the queue. Assuming the following setup

Q has messages M1, M2, M3 and has consumers C1, C2 and C3 (each of which has its own connection and channel) connected to it.

  • How is concurrency handled in the basic.get method? Is the basic.get method call synchronized to handle concurrent users simultaneously using its own connection and channel? C1, C2, and C3 call basic.get to receive the message at the same time (suppose the server accepts all 3 requests at the same time).

  • C1 requests a message using basic.get and receives M1. When C2 requests a message, since it is using a different connection, does it get M1 again?

  • How can users pull messages in packets of a given size?

+4
source share
3 answers

, (RabbitMQ - , ).

concurrency basic.get? basic.get ? C1, C2 C3 basic.get (, 3 ).

1: RabbitMQ . , , . , - , , ? . , , , , , . Takeaway. , .

C1 basic.get M1. C2 , , M1 ?

2: . RabbitMQ . . "" / . , "" , . Takeaway: .

?

: . , . ; , . , > 1 . , , . , , , , . Takeaway. , , , , .

+7

RabbitMQ Api guide Amqp.

, basicGet . basicConsume. RabbitMq . - , .

basicConsume RabbitMq prefetch. , , , , ( - ).

Concurrency , ! ( , ACKed). .

Btw, , . , .

+1

No special configuration is required for this scenario. Each client will atomically retrieve and receive one message from the queue, just as you would like.

-1
source

All Articles