Pub/Sub: how to simulate rabbitmq routing_key

79 views
Skip to first unread message

Kiran

unread,
Jan 26, 2017, 12:24:42 PM1/26/17
to masstransit-discuss
Currently we use RabbitMQ for Pub/Sub. We have a standard message defined which carries the payload and is published on an exchange with a routing key. Subscribers then subscribe with a specific routing key. This way subscribers only consumer messages which they are interested in (based on routing key). 

In Masstransit world how can I implement this functionality. We currently use Request/Response and Send (which is tied to a specific queue).

Thanks

Chris Patterson

unread,
Jan 26, 2017, 2:28:31 PM1/26/17
to masstrans...@googlegroups.com
Routing key support is coming but not currently built into MassTransit. 

__
Chris Patterson




--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/66832c97-310c-4ce8-9efa-d01753092877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kiran

unread,
Feb 1, 2017, 9:49:32 AM2/1/17
to masstransit-discuss
Thanks much.

Kiran

unread,
May 8, 2017, 4:21:31 PM5/8/17
to masstransit-discuss

I assume I can use the custom biding in consumer.  How do I add Routing Key when publishing?
 
https://github.com/MassTransit/MassTransit/pull/798


Chris Patterson

unread,
May 8, 2017, 5:20:50 PM5/8/17
to masstrans...@googlegroups.com
Use sendContext.GetPayload<RabbitMqSendContext>().RoutingKey = "....";

On Mon, May 8, 2017 at 1:21 PM, Kiran <kiran....@gmail.com> wrote:

I assume I can use the custom biding in consumer.  How do I add Routing Key when publishing?
 
https://github.com/MassTransit/MassTransit/pull/798


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/570f2a0d-4ea7-43d3-9a9f-16571c68a73c%40googlegroups.com.

Kiran

unread,
May 9, 2017, 12:54:09 PM5/9/17
to masstransit-discuss
Thanks much. One more question, how can I set the routing key in Request/Response. Also when using Masstransit.Host is there a way to set the routing Key.

### For request

 busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                var host = x.Host(new UriBuilder("rabbitmq", _hostName).Uri, h =>
                {
                    h.Username(*****);
                    h.Password(*****); 
                });
            });

busControl.Start();

 busControl.CreateRequestClient<TRequest, TResponse>(new Uri("rabbitmq://" + _hostName + "/" + queueName), timeout.Value);


Chris Patterson

unread,
May 9, 2017, 5:10:55 PM5/9/17
to masstrans...@googlegroups.com
Not really. The next version with topology makes this a lot easier to work out via conventions. I really need to finish it as it's still under development. 

The develop branch has all the code I just need to test it more. 

__
Chris Patterson

From: masstrans...@googlegroups.com <masstrans...@googlegroups.com> on behalf of Kiran <kiran....@gmail.com>
Sent: Tuesday, May 9, 2017 11:54:09 AM
To: masstransit-discuss
Subject: Re: [masstransit-discuss] Pub/Sub: how to simulate rabbitmq routing_key
 
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/bb38a24c-c778-44c7-96a3-a54b7fe13cca%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages