binding x-consistent-hash exchange to topic exchange

200 views
Skip to first unread message

Noam

unread,
Sep 3, 2023, 5:54:54 PM9/3/23
to rabbitmq-users
Hey All
I'm trying to create a binding between x-consistent-hash exchange and topic exchange like the example in the attached diagram.
However, I got an error - the routing key must be an integer, while I was trying to bind the "nba-players-stats-consistent-hash-exchange" or  "nba-team-stats-consistent-hash-exchange" to the NBA topic exchange.
Screenshot 2023-09-04 at 0.54.09.png

David Ansari

unread,
Sep 4, 2023, 12:27:02 PM9/4/23
to rabbitmq-users
Binding a consistent hash exchange to a topic exchange works as shown in https://github.com/rabbitmq/rabbitmq-server/blob/fb91185f54ef794f57195a50f4d3516ae9cc770b/deps/rabbitmq_mqtt/test/v5_SUITE.erl#L2042-L2044

Make sure to use an exchange binding, not a queue binding. In this case, the binding key will correspond to the topic filter.

When you bind a queue to the consistent hash exchange, the binding key is the weight (number as a string) as explained in https://github.com/rabbitmq/rabbitmq-server/tree/main/deps/rabbitmq_consistent_hash_exchange#weights
Reply all
Reply to author
Forward
0 new messages