Open RomanOlegovich opened 2 years ago
Overriding the SaveChanges
method is necessary only to automatically publish the domain events embedded in the models (aggregates) being saved. The outbox works independently of that and you just need to call a SaveChanges
after you published the messages in order for them to be persisted.
await publisher.PublishAsync(message1);
await publisher.PublishAsync(message2);
await publisher.PublishAsync(message3);
await dbContext.SaveChangesAsync();
Using the outbox without the DbContext
altogether is not possible. Currently, the only way to write to the database is through a DbContext
. Again, this will change in Silverback 4. :wink:
There are cron jobs, which are produce events. So I want to push event into outobox without using of DbContext (just to handle if queue doesn't work). Does Silverback help to me?)