rebus-org / Rebus.AzureServiceBus

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

Some types of event not handled in Azure Service Bus after upgrade of Rebus.AzureServiceBus #22

Closed Jeern closed 5 years ago

Jeern commented 5 years ago

Hi,

We have a new problem after upgrading from Rebus.AzureServiceBus 6.0.4 to 7.0.0-a02 because of this issue: https://github.com/rebus-org/Rebus.AzureServiceBus/issues/19

Downgrading to 6.0.4 makes this particular issue go away - but then we are back to square one with https://github.com/rebus-org/Rebus.AzureServiceBus/issues/19 :)

We have two types of events - one type is an Aggregated Event that contains other events (we do this because of Azure Service Bus'es problem with Transactions across multiple topics).

They are pretty similar - both inherent from an Abstract class that looks like this:

    public abstract class DomainEvent : IDomainEvent
    {
        public abstract Guid Id { get; }
    }

And this

   public abstract class AggregatedDomainEvent : IDomainEvent
   {
        public DomainEvent[] DomainEvents { get; }
        protected AggregatedDomainEvent(params DomainEvent[] domainEvents)
        {
            DomainEvents = domainEvents;
        }
    }

So the difference is pretty much the constructor

After upgrading - all AggregatedDomainEvents are no longer caught by Event handlers. All DomainEvents work as normal.

I have tracked down the problem to this single commit, where 6.0.4 is changed to 7.0.0-a02 - checked before and after and also tried downgrading the newest code to 6.0.4 - so I am pretty confident that this change is what caused the problem.

Could it have something to do with serialization and use of constructors ?

mookid8000 commented 5 years ago

How Rebus serializes messages has not changed for a long time (if ever?).

To me, it sounds more likely that it's the recent change to how topics are named that caused this to happen.

Have you updated all endpoints?

Jeern commented 5 years ago

No, I am not sure I even understand what you mean.:) Since endpoints are generated automatically by Rebus when it starts. Should I delete all existing endpoints ? Btw. our endpoints are lowercased with dashes so why would this affect us ?

Jeern commented 5 years ago

Correction I can see some of our topics have dots in them (is this something Rebus does for us) ? But I assume deleting them, will be the way to go then ?

Jeern commented 5 years ago

Turns out you were on the right track (as always :) ) - It was an unfortunate combination of us not registrering the handlers for AggregateDomainEvents - but not being aware of it because of an old registration still existing. And the upgrade to 7.0.0-a02 made the problem surface. Thank you for your help :)

mookid8000 commented 5 years ago

Happy to hear you figured it out 😄

I was actually writing an answer to you, but I was interrupted by something, and then Friday happened 🍻

For the Googleability of it, I'm going to post what I was writing here:

The topics with dots in them are generated by v7 of the transport.

V6 of the transport would "normalize" topic names by substituting everything not a character or a number with "_", and then it would lowercase the whole thing.

Since v7 only substitutes invalid characters with "_", it's now possible to have much clearer topic names, but it is clearly breaking compared to v6 topic names, as v6 and v7 endpoints will not readily be able to find each other.