Search code examples
rabbitmqamqp

How dose a new consumer consume the messages produced in the past in RabbitMQ?


I am a user of Apache Kafka trying to run RabbitMQ. Kafka supports a consumer to consume any messages that are produced before. (By re-widning 'offset' in Kafka's log)

I'd like to know whether RabbitMQ has the same functionality. (A new consumer comes and requests all the messages after a certain point.)


Solution

  • I'd like to know whether RabbitMQ has the same functionality

    It does not.

    Kafka is purpose-built for that feature - an event log that allows you to travel forward from a point.

    RabbitMQ is a message queue - first in, first out. Once a message is handled, it is done and gone. There is no history or log to traverse.


    There is a "recent history" plugin for RabbitMQ, but this does not provide the same feature set Kafka.

    https://github.com/rabbitmq/rabbitmq-recent-history-exchange#readme

    It only allows you to say something like "new consumers should get the last 20 messages, before continuing to get new messages".

    Kafka, on the other hand, gives you a much more extensive history and the ability to start at the beginning and move forward as needed.