How to create a very basic pub-sub queue?

75 views
Skip to first unread message

Csaba Galyó

unread,
Apr 2, 2021, 8:14:02 AM4/2/21
to rabbitmq-users

Hello,

Could someone please let me know how to create a persistent queue.

If a producer writes to it, it goes into the queue.
If a consumer reads from it, it gets taken out from the queue (other consumers can't read it anymore).

That's all. Unfortunately I've hit all sorts of issues.

If a producer is writing to a topic, but no one is listening, then it fails with invalid routing. I would like the producer to write to the topic and the message should be kept there, especially since the queue was declared to be durable.

I've tried multiple combinations, the latest I did was having a "fanout" queue, durable=true. When my Java producer writes to it, nothing will happen, the consumer will not receive it. When i add mandatory=true, channel.waitForConfirms(1000L); I'll get an exception "Confirms not selected"

Maybe "fanout" is not even what I need?

Thanks,
Csaba

Csaba Galyó

unread,
Apr 2, 2021, 12:01:21 PM4/2/21
to rabbitmq-users
Back to this subject, it looks like the root of the problem was I used "application/json" as the content type for publishing. After replacing it with MessageProperties.PERSISTENT_TEXT_PLAIN  the messages started going through.
Reply all
Reply to author
Forward
0 new messages