0 votes
in Azure by
What are Transactions in Azure Service Bus?

1 Answer

0 votes
by

Transactions are execution scopes in the context of transaction processing. A transaction groups two or more operations together. The goal of a transaction is that the result of this group of operations has a common outcome.

Azure Service Bus is a transactional message broker and ensures transactional integrity for all internal operations against its message stores and the respective indices. All transfers of messages inside of Service Bus, such as moving messages to a Dead-Letter Queue or automatic forwarding of messages between entities are transactional.

From a consumer perspective, Service Bus supports grouping operations against a single messaging entity (queue, topic, subscription) within the scope of a transaction. You can, for instance, send several messages to one Queue from within a transaction scope, and the messages will only be committed to the Queue's log when the transaction successfully completes.

The operations that can be performed within a transaction scope are:

  1. QueueClient, MessageSender, TopicClient:
  2. Send, SendAsync
  3. SendBatch, SendBatchAsync
  4. BrokeredMessage:
  5. Complete, CompleteAsync
  6. Abandon, AbandonAsync
  7. Deadletter, DeadletterAsync
  8. Defer, DeferAsync
  9. RenewLock, RenewLockAsync
  10. MessageSession:
  11. SetState, SetStateAsync
  12. GetState, GetStateAsync

Transactions that span multiple Service Bus entities require using a special API gesture. You may, for instance, want to receive/complete a message from one queue and send it to a different queue within a single transaction scope. That is done using transfers (EnableCrossEntityTransactions).

...