Neil Dobson
Neil Dobson

Reputation: 1259

How to use RoutingKey with ServiceStack and RabbitMQ

I have two identical sites which will consume RabbitMQ messages using the new Rabbit MQ client. The producer ideally should be able to designate the site either by queue name or routing key. The former I can do as a Publish parameter but the latter I have no access to. Furthermore, on the service side, the consumer appears only able to subscribe to convention-based queue names, i.e. mq.myrequest.inq and I don't seem to be able to take advantage of the routing key.

Is there a way I can publish and subscribe using my own routing key, or register the handler based on an explicit queue name, i.e mq.myrequest.site1.inq ?

Upvotes: 3

Views: 674

Answers (1)

mythz
mythz

Reputation: 143339

There isn't. ServiceStack's RabbitMq support is conventionally based on Type names and is opinionated to function as a work queue. It was designed to be config-free and simple to use so automatically takes care of the details of which exchanges, routing keys and queue names to use.

If you need advanced or custom configuration it's best to instead use the underlying RabbitMQ.Client directly.

Upvotes: 2

Related Questions