Skip to content
A simple active/active Azure Service Bus example using Cosmos as a reliable journal
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Active replication example for Azure Service Bus using Cosmos DB as a journal

An example of one way to maintain consistency + availability of Azure Service Bus across regions using an out-of-band processing journal

  • Send availability via sending the same messages to n queues
  • Receive availability by logging work items in Cosmos DB (in strong consistency mode) to prevent processors from re-processing messages



  • Senders are using Service Bus Sessions to group and linearize messages
  • Cosmos DB is using the Document API, mostly because there is no Cosmos Table API SDK for .net core yet - Tables would probably be a better use here than documents
  • Cosmos DB is in strong consistency mode


  • Switch from Session + Message journaling to just sessions, to prevent a race where messages are potentially processed out of order within the same session (E.g., Session A, message 1 gets picked up, the session in region A is locked, but the session in region B is not; the message is locked because we've logged the work item, but not message 2)
  • better docs
  • clean-up and refactor to be more flexible with events

To use this sample, you'll need

  • n Service Bus Queues
  • A Cosmos DB account, with a document collection
You can’t perform that action at this time.