I have 2 NServiceBus buses with both configured to use Sql Transport. I would like to perform the following activities between them:
1) Publish events
2) Send commands (no pub/sub for this).
Upon investigating this, I arrived at a number of candidate solutions:
1) Use the HTTP gateway. I did not use this option as I would prefer to keep all the activity against the databases. Therefore I discounted this.
2) Adapt the SqlBridge sample from the NServiceBus.SqlServer.Samples on Github. This appears to have the ability to monitor an input queue (albeit in Msmq) and then publish to its own Bus where subscribers can then receive the events. I have some questions on this solution:
3) A bespoke solution. (I have taken much of the detail away from this to keep it brief and save those weary eyes :-) )This solution involves having a dedicated (non NServiceBus) database that NSB hosts will post messages to. To bridge between 2 buses, an NSB host would handle a message and write to an event table. On the other bus, an NSB host would monitor this table using IWantToRunWhenBusStartsAndStops and then sending to its Bus.
I like the idea of option 2 as this appears to be using existing constructs (always assuming I have the understanding of IAdvancedSatellite which I hope someone can provide)
I solved this by using the IAdvancedSatellite sample. I adapted this by providing the connection string and the queue on the 'source' that the satellite would obtain the messages to bring into the destination bus. Things to take note of:
1) You have to create the SQLBridge queue in the 'source' bus. 2) You have to create the event subscription from the source publisher to the SQL Bridge queue on the source bus.
The above 2 items would be trivial to auto-configure but currently my solution is only a PoC.
Regards.