entity framework - MassTransit outbox pattern - Stack Overflow

admin2025-04-17  4

I am using the outbox pattern in MassTransit with Entity Framework and RabbitMq in my application.

I found that if I just publish the message to the bus using IPublishEndpoint it will not be published until I do DbContext.SaveChangesAsync().

I understand that this is by design, but I don't need (want) to use outbox for every messages. I.e. I have some messages that are not important to be sent through the outbox, and for that I don't want to require the injection of DbContext just so I can send the message.

In short, I only want to use the outbox when there is a database involved in a process, i.e. update an entity and send the message (here the database is involved in a process/transaction and here I want the outbox, but when I only need to notify other services of something or just to forward a message, I don't want to use the outbox for that).

Is this possible?

转载请注明原文地址:http://www.anycun.com/QandA/1744873003a88824.html