azureazureservicebusazure-servicebus-topicsazure-servicebus-subscriptions

Azure Service Bus - Is EnableCrossEntityTransactions necessary for forwarding messages within subscriptions under the same topic?


I've read all the documentation I could find and this case is still not clear to me. When I receive a message from subscription A and then use a transaction to complete the message and send a new message to the same topic (but to a different subscription), is it necessary to configure the Service Bus client with EnableCrossEntityTransactions?

The flow:

  1. Receive message M1 from subscription A (topic T1)
  2. Start transaction
  3. Complete message M1
  4. Send message M2 to topic T1 (will be routed to subscription B)

Solution

  • While the subscription used to receive is under the same topic used to dispatch to, those are two different entities.

    If you want to ensure completion of M1 and dispatching of M2 are happening atomically, succeed or or rolled back together, a transaction is necessary and the option EnableCrossEntityTransactions is required. Otherwise, you're risking completing the incoming M1 message without successfully dispatching M2.