First some background:
We are in the process of removing a home grown web api/messaging ‘synchronisation’ mechanism from our NSB based platform. This used custom message headers, a process id and a DB polling mechanism to allow us to support 200 style ‘synchronous’ web api calls over the asynchronous message based back end.
Before I go any further I will make it clear that we have long had this flagged as an anti pattern - it has just been so deeply embedded in our older API that it has been a challenge to factor it out till now.
To replace this we have implemented a command ‘executor’ pattern in our legacy web api to allow us to ‘handle’ commands synchronously in the controller code where absolutely necessary. Where this results in events being fired we are leaning on a shared subscription store so that the web api can publish events on to the appropriate consumers.
This is all going swimmingly - performance of the SPA apps that consume this legacy API has improved dramatically - the code is a huge step closer to a vanilla NSB implementation etc etc…
But there is one downside - we loose the transaction scope/unit work around these commands we handle directly within the web api. Events can go out ahead of business data fully committing to the DB, or worse could go out when the associated business data has failed to commit. At present we have had to accept this as the cost for the benefits we gain in eliminating the complex synchronisation mechanism, and it is a trade off we are quite prepared to make.
However, I want to know if the Particular team have made any progress towards supporting the outbox shared session scope outside the context of NSB message handlers - i.e. make it possible for these kinds of web api hosted business operations to be supported?
I found this page from awhile back with some suggestion of a solution - but the thread is cold: https://groups.google.com/forum/#!topic/particularsoftware/rF11h7ebHF4
Jeremy Miller has tackled this with his implementation of outbox for his Jasper framework - he’s clearly been informed by NSBs outbox work but he has made the mental leap which decouples the outbox mechanism from a hard dependency on the handler running in the context of a back end worker: https://jeremydmiller.com/2018/04/16/jaspers-outbox-pattern-support/