I'm writing Python script cron-job, which is periodically get updates from RabbitMQ and process them. Every time I process them I need only to get current snapshot of RMQ queue. I use queue_declare to get number of messages in it.
I know how to get messages one by one with basic_get. Also, I can use basic_consume/start_consuming and get messages in background, store them in some list and periodically get from that list, but what if script will fail with some error? I will lost all read messages in list. Also, I can use few consumers (pool of connections to RMQ) and get messages one by one. Maybe there is some other approach to do it?
So, my question is - what is the best (i.e. secure and fast) way to get current messages from RabbiMQ queue?
The best way to consume the messages is using basic_consume.
basic_get is slow
The best way to read a lot of messages from RabbitMQ queue?