<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I am implementing an abstraction over dynamic pub/sub. �The idea is that you have named &quot;themes&quot;, and within those themes you have &quot;subjects&quot; that can be used as a filter. �Themes may or may not be transient.</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I think have two choices:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
1) Each named &quot;theme&quot; is a separate topic exchange and &quot;subjects&quot; map directly to routing keys�<i>(i.e., &quot;stocks&quot; topic exchange, with messages having routing keys like &quot;nasdaq.apple.price&quot;)</i>.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">2) There is a single topic exchange and the routing key is a composite of theme and subject�<i>(i.e., &quot;themes&quot; topic exchange, with messages having routing keys like &quot;theme.stocks.subject.nasdaq.apple.price&quot;)</i>.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Although #1 has a better one-to-one mapping to my problem, I am inclined to go with #2 because it is much easier to manage (a single exchange that never gets deleted, vs many exchanges that I must manage the lifecycle of).</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">The only thing I am unsure of is if there is any difference in performance? �Multiple exchanges are more expensive in memory, but will a single exchange need more CPU to route messages because it is dealing with so many more disparate bindings?</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks for any guidance.</div></div>