Issues migrating Azure Service Bus Transport from v4 to v5

I’m currently testing the migration of the Azure Service Bus Transport from v4 to v5. I’ve some issues with the backwards compatibility of v5 with v4. See picture below.

Currently the test service is sending a command that is correctly handled within Service A. Only when Service A is publishing MyEvent1, it is never handled by the test service. When Service A goes back to V4, it all works again.

Within Service A I extracted from ‘topology-migration_asbs_5_net8_0’ the core idea of the migration (https://docs.particular.net/samples/azure-service-bus-netstandard/native-integration/).

I’ve added the following logic in the UseNServiceBus of service A:

var migrationTopology = TopicTopology.MigrateFromSingleDefaultTopic();
migrationTopology.EventToMigrate<MyEvent1>();

var transport = serviceBusConfiguration.AdvancedConfiguration.UseTransport(new AzureServiceBusTransport(connectionString, migrationTopology));

serviceBusConfiguration.Transport.Topology.Validate();

Is something wrong with this code? I’m executing this code within the UseNServiceBus from the FunctionsHostBuilderExtensions.

Hi @KelvinS ,

Not sure I understand your problem exactly and what it means that MyEvent1 is never handled by the test service. You mean it’s not being picked up and ignored? Is there logging that it can’t find an appropriate handler or something?

Could it be because you deploy a new version of a message assembly (a specific assembly with just messages so you can share the type) or you’re modifying the headers of the native integration message yourself?

We recommend for new versions of an assembly (or NuGet package) to not modify the AssemblyVersion but rather modify the AssemblyFileVersion.

More information about it can be found in our docs, like here.

Let me know if this helps, or if you’re experiencing a different kind of problem.

Hi @Dennis,

Thanks for your answer. Currently, both services use the same NuGet message package for ‘MyEvent1’. I mean that the event isn’t being picked up by the testservice; it’s being completely ignored. There’s no logging because it isn’t being handled. In your post, you suggested modifying the AssemblyFileVersion. Since we’re using our own NuGet package, that wouldn’t be an option, right? If it is an option, how would I change it?

I mean that the event isn’t being picked up by the testservice; it’s being completely ignored.

But if it’s ignored, that means the message stays in the queue? Because that’s not right. If NServiceBus can’t handle the message, there should be a log entry and it should be moved to the error queue.

If it is an option, how would I change it?

The NuGet version is something completely different, although 99.9% of the times, the two match up. But when it’s used in production, there’s no NuGet package anymore, just the assembly (the .dll).

For versioning the assembly, you can use AssemblyVersion and/or AssemblyFileVersion. The first is used by .NET to verify which assembly version you’re using. Hence the name :slight_smile:

The gist is that if you reference AssemblyVersion 1.0.0 and it changes to 1.1.0 you need to update the reference in your project. However, if you use AssemblyFileVersion for updating the version while keeping AssemblyVersion at 1.0.0, .NET doesn’t require an updated reference.

I won’t go into more details, as numerous articles have already been written about them. Here are some I could quickly find and found helpful.

1 Like

@KelvinS

You mentioned the function app. Are you using the isolated worker model? In there you can’t use UseTransport. This upgrade guide describes how to load the event mapping from the configuration

Could that be the problem because the topology is not actually set?

Regards,
Daniel

1 Like