Did you have the publish call in a synchronous execution path?
Could you elaborate a bit your scenario so that we can have a closer look? Maybe share some snippets?
Regards
Daniel
Did you have the publish call in a synchronous execution path?
Could you elaborate a bit your scenario so that we can have a closer look? Maybe share some snippets?
Regards
Daniel
Hi @danielmarbach,
Sorry for delayed response - missed a notification.
Unfortunately awaiting the publishing call solved the problem only temporary. Perhaps it was just a coincidence.
It seems like the root cause is in topic bundles (bundle-1, bundle-2) of Azure Service Bus which we use as a transport.
NSB 7 seem to create subscription only in bundle-1 while NSB 6 creates it in both bundle-1 and bundle-2.
When I looked into the publisher debug logs Iāve found the following line:
DEBUG DefaultOutgoingBatchRouter - Routing 1 messages to bundle-2
.
Seems like new NSB 7 subscriber is not receiving the message because itās listening only in ābundle-1ā, while NSB 6 subscribers are listening in both ābundle-1ā and ābundle-2ā. Publisher is routing to one bundle or another - therefore it is unstable.
Publisher is .Net Framework 4.6.1 and using the following nuget packages:
<package id="NServiceBus" version="6.3.4" targetFramework="net461" />
<package id="NServiceBus.Autofac" version="6.0.1" targetFramework="net461" />
<package id="NServiceBus.Azure.Transports.WindowsAzureServiceBus" version="7.2.4" targetFramework="net461" />
<package id="NServiceBus.DataBus.AzureBlobStorage" version="1.1.0" targetFramework="net461" />
<package id="NServiceBus.Log4Net" version="2.0.0" targetFramework="net461" />
New subscriber is .Net Core App 2.2 with the following nuget packages:
<PackageReference Include="NServiceBus" Version="7.1.10" />
<PackageReference Include="NServiceBus.MSDependencyInjection" Version="0.1.4" />
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="2.2.0" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="1.2.1" />
Publisher config (NSB 6):
endpointConfiguration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(Bus)
.UseForwardingTopology()
.Transactions(TransportTransactionMode.SendsAtomicWithReceive)
.Sanitization().UseStrategy<Sha1Sanitization>();
Subscriber config (NSB 7):
configuration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(options.ConnectionString)
.Transactions(TransportTransactionMode.SendsAtomicWithReceive)
.RuleNameShortener(Sha1Sanitization.ShortenerFor(TransportEntity.Rule))
.SubscriptionNameShortener(Sha1Sanitization.ShortenerFor(TransportEntity.Subscription))
.EntityMaximumSize(1);
I feel like this is some common problem, but couldnāt find any docs on solution.
Would be very glad if you point me in the right direction.
Best regards,
Alex
Hi
Thatās interesting. As far as I remember the default number of entities in a bundle is set to 1
. Is there any endpoint that actually requires bundle-2
?
Can you check whether any of the endpoints has set the number of bundles explicitly?
forwardingTopology.NumberOfEntitiesInBundle(2);
if not and if all v6 compatible publishers are on 7.2.4
then you should be able to delete bundle-2
on the broker.
@SeanFeldman can you verify and confirm?
Regards
Daniel
Thanks for your help.
No, we donāt use NumberOfEntitiesInBundle api.
Havenāt found docs, but according to the code it defaults to 2 bundles in v.7.2:
I can see the issue is already mentioned as āpotential message lossā, but for different version though
Iāve tried to delete bundle-2 but then publisher is not able to publish a message:
Failed to dispatch a batch with the following message IDs: ...
40400: Endpoint not found., Resource:sb://<our-servicebus>.servicebus.windows.net/bundle-2.
Itās weird I havenāt found this problem mentioned anywhere in migration docs (or Iām just not that much into NSB terminology).
We have around 15-20 services running with legacy Azure ServiceBus Transport, but we want to use .Net Core for new endpoints (with new Azure ServiceBus Transport).
Most of our services are on 7.1-7.2 version of Legacy Azure Transport, but there are couple on 6.4 and couple on 8.
Any thoughts on how to make it work together or migration plan to (non-legacy) Azure ServiceBus transport?
Yeah sorry my research led me to this
Only realized later that we have shifted things a bit.
So the fix is the following
forwardingTopology.NumberOfEntitiesInBundle(1);
on all the v6 publishersbundle-2
Iāll see if we can make that a bit clearer in the upgrade guides
Regards
Daniel
Alexander,
I did some more digging. Apparently we removed the documentation for NumberOfEntitiesInBundle
at some point because we wanted customers to stop using it. v8 and v8 of the legacy transport already restrict the usage to one bundle and only allow to change the bundle prefix.
We already have compatibility guidance available here
but unfortunately that didnāt mention the fact that the number of entities in the bundle need to be set to one for v7 publishers. Iāve added a note
Regards
Daniel
Thanks for all your help, we will plan and update our services.
As far as I understand itās vital to set NumberOfEntitiesInBundle
to 1 for publishers, but itās not that important for subscribers which are not publishing (they will listen on both bundles, but receive actual messages only on first).