How to use rabbitmq's stream for message deduplication in python?

176 views
Skip to first unread message

leon

unread,
May 9, 2022, 7:03:34 AM5/9/22
to rabbitmq-users
I want to deduplicate messages in rabbitmq queue
The programming language I use is: python

Is there any example to see how to use rabbitmq's stream queue for message deduplication in python?
Or do you have a better way to deduplicate the queue message of rabbitmq

Gabriele Santomaggio

unread,
May 9, 2022, 10:41:01 AM5/9/22
to rabbitmq-users

With this client: https://github.com/qweeze/rstream

you can pass the publisging_id  to the message and publisher_name to the publish  in this way:

for i in range(100):
         amqp_message = AMQPMessage(
         body="this is a message {}".format(i),
         publishing_id=i, # this will handle the duplication wiht to publisher_name 
)

await producer.publish('mystreamu', amqp_message, publisher_name="my_publisher_name"
)


Regards
-
Gabriele

Reply all
Reply to author
Forward
0 new messages