0

Looking at the Publish-Subscribe API and Configuration page, it would seem that the database schema used by NServiceBus to track subscriptions only tracks the Subscriber Endpoint and Message Type.

I had hoped that maybe I could change the name of the table in order to use the same database for multiple publishers, but this thread seems to indicate that you can't.

The point is - I fully understand and agree with the notion of having a single publisher endpoint per event type - but that inevitably leads to having multiple publishers all operating out of the same application scope. Perhaps operating in different assemblies or processes but that is a moot point; regardless, it means that all or most publishers will share the same transactional database. So the possibility of having to actually create a separate SQL database for every individual publisher seems slightly ridiculous; we'd end up with hundreds of single-table subscription databases sitting around.

Does the DBSubscriptionStorage track enough information to identify the publisher as well, such that multiple publishers can all be pointed to the same database? Or if not, is there some configuration change or hack that I could use to accomplish the same end result?

Or am I actually going to need a separate database for every publisher - and by extension, every published message type?

Simon
  • 33,714
  • 21
  • 133
  • 202
Aaronaught
  • 120,909
  • 25
  • 266
  • 342

1 Answers1

3

You absolutely can use the same table in the same database to store the subscriptions of multiple publishers. Since each publisher is responsible for its specific message types, there will be no logical overlap.

Udi Dahan
  • 11,932
  • 1
  • 27
  • 35
  • That's a very good point which seems obvious in hindsight. I'm wondering though, will performance start to suffer if there are hundreds (or maybe someday, thousands) of subscriptions in that table, or does the implementation only query on the specific message types it cares about? – Aaronaught Apr 11 '11 at 23:54
  • The table is indexed which makes querying for a subset of subscribers a very cheap operation--even with a table that could somehow contain hundreds of thousands of subscription entries. – Jonathan Oliver Apr 12 '11 at 00:49
  • Udi, I have one message assembly for all my messages that each publisher references. Does this still work in this case? – Jeff Apr 19 '11 at 23:43
  • Jeff, that's not a recommended setup - will make versioning harder. – Udi Dahan Apr 20 '11 at 18:22
  • @Udi Understand the versioning issue, but does it have any bearing on what gets into the subscription storage? It looks to me like there's a row per subscribed-to message type, so it would seem to not matter how many assemblies are involved. – jlew May 20 '11 at 19:43