0

I read the rabbitmq tutorials and really liked the Idea of topic exchanges. In my architecture I would have topics like continent.city.street. Where, as you can imagine, there are only a limited number of continents, but nearly infinite cities & streets, which both can have duplicated names (like NorthAmerica.GeorgsTown.Mainstreet, Europe.GeorgsTown.Mainstreet, Asia.NewTown.Mainstreet and Australia.NewTown.LostRoad)

Now I learned that Masstransit, a Libary I want to learn/use, does not support this kind of topics. (There are somehow supported but then I also could use a generic RabbitMq client)

So what is the best way to achieve a similar thing, as with rabbitmqs topic exchanges, but with Masstransit (over (any) MQ/rider system), in regards of performance?

Some facts which could make the difference regarding performance:

  • Nearly no consumer is interested in a whole continent - but some are. Asia.*.*
  • Continents primary goal is to make cities unique (in this fictional case).
  • About ~30% of the consumers would like to subscribe to cities regardless of continent or street. *.GeorgsTown.*
  • About ~30% of the consumers would like to know what happens on specific streets regardless the city or continent. *.*.Mainstreet
  • About ~30% is watching for specific combinations like Antarctica.GeorgsTown.Mainstreet
JoshMc
  • 10,239
  • 2
  • 19
  • 38
Fritz
  • 831
  • 7
  • 23

1 Answers1

0

MassTransit supports topic exchanges just fine, they're similar to those defined in the Direct Exchange sample, but using a topic pattern routing key instead.

Chris Patterson
  • 28,659
  • 3
  • 47
  • 59
  • Thanks for your response. If I tested it correctly - the filtering is done on the client side? However I only found the `x.UseRoutingKeyFormatter()` – Fritz Oct 11 '21 at 15:19
  • 1
    The filtering is done by RabbitMQ when using topic exchanges. The routing key formatter is just to set the routing key automatically when sending/publishing messages. You can also set it explicitly when sending/publishing a message. – Chris Patterson Oct 11 '21 at 18:35
  • The created exchange is of type `fanout` when I use the RoutingKeyFormater with the given topic syntax. It only gets change to topic if I use `cfg.Publish(x => { x.ExchangeType = ExchangeType.Topic; });`. Is this the correct solution (combining both commands)? – Fritz Oct 11 '21 at 21:06
  • Yes, you'd need to configure the exchange for every message type. – Chris Patterson Oct 12 '21 at 00:53