Home  >  Q&A  >  body text

java - Questions about queues under concurrent operations?

Commonly used rabbitmq, activeMq queues, multiple consumers or multiple threads to get the data in the queue, will it happen that different consumers arrive at the same time to get the same data? At present, we only know that since redis is single-threaded, this situation can be avoided when doing queues.

PHP中文网PHP中文网2674 days ago1001

reply all(2)I'll reply

  • 漂亮男人

    漂亮男人2017-06-23 09:16:19

    There are many publish and subscribe modes for message queues. There is a mode where a message can be obtained by multiple consumers. There is a mode where a message is sent to a designated consumer. Choose the one that suits you~
    You can use rabbitmq for the one you mentioned. direct mode

    reply
    0
  • 大家讲道理

    大家讲道理2017-06-23 09:16:19

    Any message queue that claims to be a message queue service will guarantee this, so there is no need to worry. But it should be noted that the message queue has two modes, the producer-consumer mode and the publisher-subscriber mode. The former guarantees that each message will only be consumed once, and the latter guarantees that each message can reach all subscribers, so The number of times consumed is uncertain.

    reply
    0
  • Cancelreply