Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

MassTransit Routing

From time to time, I get requests for routing in MassTransit. We want to identify and configure, at design time, where a given message is going to be sent. “I want all BuyWidget messages to go to msmq://localhost/widget_buyer”. While this really isn’t the way that I like to think about things from a SOA / EDA perspective, I felt this was a valid feature request and decided to go ahead and add it today. This is what it looks like.

IServiceBus bus = ServiceBusConfigurator.New(b =>
{
  b.ReceiveFrom("msmq://localhost/mt_client");
  b.ConfigureService<RoutingConfigurator>(rs =>
  {
    rs.Route<BuyWidget>().To("msmq://localhost/widget_buyer");
  });
});

You should now be able to use the pub/sub semantic without actually having the subscription service installed and running. If you find you need to configure the routing more dynamically, like if you start thinking about driving this process from a database, I would recommend you take another look at the subscription service.

Currently you can only do this in code, but it should be easy enough to extend into some xml config if you are so inclined. This the first pass at this functionality so let me know what you think.

-d

About Dru Sellers

Sr. Software Engineer at Dovetail Software.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • rg

    “Although I don’t like this idea, I’ll implement it because others have asked”. A real servant of the community – very rare species among developers. Although I didn’t like MT at first, I’ll be giving it a second chance because its author isn’t an architecture demi-god pretender.

  • http://phatboyg.lostechies.com/ Chris Patterson

    Wow, this is really cool!