Outbox requires transport to be running in ReceiveOnly mode. Use the TransportTransactionMode property on the transport definition to specify the transaction mode.
We saw the known limitation regarding AdvancedConfiguration.UseTransport(..), and instead use the .Transport property.
The added code compared to the downloaded example code is:
.UseNServiceBus((configuration, endpointConfiguration) =>
{
var persistence = endpointConfiguration.AdvancedConfiguration.UsePersistence<SqlPersistence>();
persistence.SqlDialect<SqlDialect.MsSqlServer>();
persistence.ConnectionBuilder(() => new SqlConnection("<connection string>"));
persistence.TablePrefix("_NSB_");
endpointConfiguration.Transport.TransportTransactionMode = TransportTransactionMode.ReceiveOnly;
endpointConfiguration.AdvancedConfiguration.EnableOutbox();
})
And except for the packages provided with the example, the follwing are added:
When we omit those two lines, and we shutdown our database before sending out the FollowupMessage() in the TriggerMessageHandler, then it fails because as we understood, it tries to write to the outbox in database. Is this assumption correct?
We just checked, and even though have have set NServiceBus.AzureFunctions.Worker.ServiceBus to 4.* we get 4.1.0. It seems that * respects our wish to get the highest stable version.
So we have the issue with 4.1.0. We’ve tested it on two machines (Mac + Windows).
Hi Andreas,
We are using “NServiceBus.AzureFunctions.Worker.ServiceBus” Version=“4.2.3”.
When trying to set the transportTransactionMode to receiveOnly, we are getting the following error at compile time.
“Transport TransactionMode is controlled by the Azure Service Bus trigger and cannot be configured via NServiceBus transport configuration API when using Azure Functions.”
We are trying to do the following, in Nservicebus v8.2.
ServiceBusTriggeredEndpointConfiguration.Transport.TransportTransactionMode = TransportTransactionMode.ReceiveOnly;
NSB documentation suggests that we must set it to ReceiveOnly, since we are using outboxing.
You are correct that outbox requires transaction mode to be set to ReceiveOnly.
When NServiceBus runs on top of azure functions transactionality is determined by the azure function since NServicBus is not involved in receiving the message. Since isolated worker only supports ReceiveOnly mode it is set by default so you don’t have to set anything, it will work with the outbox “out of the box”
Thanks for the reply and looking into it!
Not sure if that documentation needs to be updated or the code needs to be fixed.
However, when we debug, with outbox enabled endpoint in Azure function, the default value that TransportTransactionMode is set to is SendsAtomicWithReceive.