Hi,
Is it possible to publish/send outside a message handler and using the outbox pattern with a business transaction ?
If yes, is there any sample for inspiration ?
Thanks
Hi,
Is it possible to publish/send outside a message handler and using the outbox pattern with a business transaction ?
If yes, is there any sample for inspiration ?
Thanks
Hi
Currently NServiceBus does not support this scenario. You might want to take a look at this recent thread Homegrown outbox (store and forward) for send-only endpoints and also the older one Outbox in an ASP.NET Core scenario.
The community-base solutions that you might find useful are
Szymon
Thanks for your reply!
It seems the community-base solutions relys on SqlServer, and I’m unfortunately in a context where SqlServer couldn’t be used, we have only PostgreSQL engine.
Best regards
@manuc66 then maybe the WebOutbox can be modified to include a concept of SQL dialect? The connector depends on the SQL transport so it seems not feasible to port it to PostgreSQL unless there is a PostgreSQL transport.
Hi @manuc66
We have recently released NServiceBus.TransactionalSession which guarantees atomicity between data modification and message sends outside of a handler (e.g. a web controller).
Internally, it works with your persistence package of choice so with SQL Persistence it would work just fine with PostgreSQL.
Thank you very much for the update!
Do you have some code sample on how it could be used in the context of existing applications that have “non-trivial processing logic in controllers” ?
In particular, I’m also very interested to find a way to tell NServiceBus to use the ambient SqlConnection because the so-called existing application is in control of the database connection and transaction ?
Hi
We have a sample here that shows the usage with Entity Framework. The code is fairly trivial but is has all the moving parts in it.
Unfortunately in the current implementation the connection has to be managed by NServiceBus. I raised an issue to keep track of the ability to pass the connection from outside as a possible future improvement. Could you please “thumbs up” the issue if it covers your scenario or comment on it with more details?
Szymon