-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to send a message directly on an alternative exchange #33
Comments
It would be possible to allow for alternative exchanges if the GetSubscriberAddresses() could be changed to the following: public async Task<string[]> GetSubscriberAddresses(string topic) Simple, but important |
Looking at your PR, and thinking some more about this particular issue, I have these thoughts:
|
Regarding (1): Although, one might want to customize the exchange name, because of – who knows? – to avoid conflicts with existing stuff? Taste, even? The current behavior (which I actually changed slightly in Rebus.RabbitMq 5.0.0-b06) is to treat await bus.Advanced.Routing.Send("my-queue@random-exchange", someMessage); as a genuine wish to send the message to the queue This is done once for each queue/exchange combination that the bus instance sends to in its lifetime, so the time it takes is negligible. |
Regarding (2): The reason it makes sense, is it makes it possible for exchanges to work as namespaces thus making is possible e.g. for different applications to do pub/sub without interfering with eachothers' events. One could imagine something like await bus.Publish(new AccountCreated(...)); happening in many types of otherwise unrelated applications, so I guess that's a good feature. One could even await bus.Publish("an ordinary string!"); so supporting pub/sub with a global message broker could be messy, if exchanges could not be used to implement a scope for subscriptions. QUEUE NAMES are global though, so if a broker instance is used for multiple applications, great care should be taken to ensure that queue names are unique across the entire world. |
I think (2), (3), and (4) can be implemented simply by using the So... would you like to maybe make the adjustments to your PR? |
Point 1 is already solved, as your saying, so yes please, I'll do the update to fulfill point 2, 3 and 4. If I understand your opinion, I'll just simplify the code allowing for publishing to only one alternate exchange at a time. And I gotta say, Rebus is great open source library! |
Please have a look at the update to my PR. Simplified the code so that it is only possible to publish to one exchange at a time. |
Fixed by #36 , which is out in Rebus.RabbitMq 5.0.0-b08 now 👍 |
Is it possible to extend the Rebus library to allow for sending messages on alternative exchanges, other then the default exchanges?
Example:
Bus.Advanced.Routing.Send("alternativeExchange", "queue", message)
Bus.Advanced.Topics("alternativeExchange", "topic", message)
Another alternative would be to use existing interface, but allow for setting which exchange to use with a simple routing topologi in the topic or destination address:
Example:
Bus.Advanced.Routing.Send("queue@exchange", message)
Bus.Advanced.Topics("topic@exchange", message)
Maybe it could be possible to use this topology for overriding which exchange to bind the topic?
Example:
Bus.Advanced.Topics.Subscribe("topic@exchange")
The text was updated successfully, but these errors were encountered: