rebus-org / Rebus.AzureServiceBus

:bus: Azure Service Bus transport for Rebus
https://mookid.dk/category/rebus
Other
33 stars 20 forks source link

Topics are only created upon subscriptions #36

Closed mikanyg closed 4 years ago

mikanyg commented 5 years ago

It appears that the behaviour of auto-creating topics have changed between v4 and v6 of the Rebus.ASB package.

Previously the topic was created by the publisher (when sending the message), but now it is only created once a subscriber subscribes to a topic. I cannot find this behavior change documented in any of the 5 or 6 releases, and caught us by surprise.

Are this intentionally? I would have expected that publishers owns published event messages as well as topics, and subscribers owns input queues and topic subscriptions.

mookid8000 commented 5 years ago

hmm, no it doesn't seem to be documented anywhere

But you are right that topics are now created when the first subscriber subscribes to it. I can't seem to recall exactly why that happened.

In older versions of the transport, I think both subscribers and publishers would automatically create the topic upon first encounter.

I definitely see your point that publishers "own" the topic, so in that sense it makes sense for them to create them. OTOH topics are more fluffy than queues, in that it shouldn't really matter whether they exist or not, as events can always be published to 0 subscribers, so the publisher should not care about that.

mikanyg commented 5 years ago

I understand your point regarding publishing to 0 subscribers, but once you add in something like Azure Application Insights that auto-monitors communication to Azure Service Bus, it will show up in the logs as a failed dependency call since ASB client throws the EntityNoExistException (or something like it).

So I would argue that either the initial behavior was the pragmatic approach and the publisher only would be the idealistic approach, while the current subscriber approach seems wrong.

Any chance for changing the behaviour, might be able to do a PR on this if you can agree on an approach.

mookid8000 commented 5 years ago

You've convinced me. 😃

I think both the publisher and the subscriber should be capable of creating topics – otherwise, Azure Service Bus would be the only transport that would force you to start a publisher and have it publish an event, before a subscriber could subscribe.

I think the approach would be pretty simply, because the transport should just have a check re-introduced that checks for the existence of a topic before publishing to it.

PR is most welcome! 👍

mikanyg commented 5 years ago

I've been busy, will give it a look during this week.

ghost commented 4 years ago

Is this now implemented? I don't see any topic appearing without subscribers. ✌️

mookid8000 commented 4 years ago

Hi @mikanyg , if you're working on this, please let me know ... otherwise, I can take over this task 🙂

mikanyg commented 4 years ago

Never got around to it. Had a project change so Rebus is not currently in my everyday life 😢. So @mookid8000 you are welcome to take over.

mookid8000 commented 4 years ago

@mikanyg I'm so sorry to hear that 😭

But it's OK, I'll take it from here 👍

mookid8000 commented 4 years ago

Topics are now created by both publishers and subscribers.

It's out in Rebus.AzureServiceBus 7.0.0-a15

sabbadino commented 4 years ago

Hi, any idea about when the 7.0.0 will get stable ? I need this feature :) thank you enrico

mookid8000 commented 4 years ago

unfortunately #42 is still haunting me......