Multiple endpoints using the same cosmos container for outbox?

Hello all,

we have an NSB endpoint hosted in azure functions using cosmos persistence along with the outbox feature, we use a single container approach which hosts the following documents with the same customerid paritionkey.

  1. Saga – for the workflow
  2. business document - for external read and writes.

Now we have a new requirement where we need to trigger a new message to the saga and also update the business document from a blazor server to the endpoint described in #1

Questions

  1. both the endpoints write to the same business document, so can we have both the endpoints using outbox with the same container??

  2. a simple scenario on why we want to implement outbox on the blazor server endpoint, and is there a better approach for the following use case
    Upon clicking a button, we want to perform the following actions:

  • Write data to the database to capture that user clicked this button
  • Submit a message to saga in the function endpoint to fire another process
  • Refresh the page.
  • After the page refresh, the previously written data will be retrieved, allowing us to disable the button that was clicked so that the user cannot click multiple times.

Hi,

Yes you can have the same container for both endpoints using outbox, here is some documentation regarding setting a custom container.

Regarding your 2nd question, yes the transactional session is the right feature to use for this scenario. Here is a sample that shows you all this working.

Let us know if you have any further questions.

Regards
John