streadway / amqp

Go client for AMQP 0.9.1
http://godoc.org/github.com/streadway/amqp
BSD 2-Clause "Simplified" License
4.88k stars 621 forks source link

Publishing to exchanges with wildcard routing key #386

Closed samrreynolds4 closed 5 years ago

samrreynolds4 commented 5 years ago

Hello,

I'm publishing to an exchange using the routing key of test.* and then I'm making queues with the binding key of test.1. Everything works with no errors, but the queues don't receive any of the messages from the publishings.

Is it possible to do what I'm trying to do or is there a better method for doing what I'm trying to do, like a fanout exchange or something?

michaelklishin commented 5 years ago

Please post questions to the rabbitmq-users mailing list.

michaelklishin commented 5 years ago

An unroutable message is not an error condition in the protocol. Publishing to a non-existent exchange, however, is. Publish messages as mandatory and register a return handler if you want to detect unroutable ones.

I can only guess what you are trying to do. Sounds like you are trying to do topic-based routing which is covered pretty well in the tutorials. With a topic exchange patterns are specified on the binding, not at the time of publishing. There's a tier 2 plugin that allows for "reverse topic routing". It is not particularly popular but it does exist.

Not sure why a fanout would be a viable alternative since fanout exchange (also covered in the tutorials) route to every bound queue unconditionally.