DEV Community

Discussion on: Event-driven integration #4 - Outbox publisher (feat. IHostedService & Channels) [ASPF02O|E043]

mhduke profile image

fascinating as usual. we appreciate the efforts joao. may god guide you.

I have two comments, I know im late :) but im counting on your forbearance.

First, how are we going to resume looking for new OutboxMessages?
it seems that OutboxFallbackPublisher.PublishPendingAsync() is going to return once it has finished looking up all messages. when auth service (in this example) goes through off peak hours, the publishing stream will come to an end. Do we need actual time fashioned polling then?

Second, this immediate/fallback publishers approach seems to work well with events that require no order of occurrence, as events polled/published with the fallback publisher are certainly out of order. for example the number of Likes of a post, will not require the order, on the other hand, comments of a post will most certainly do.

I hope upcoming event-driven episodes are less intense than this one :) more like the previous 3 ^^

joaofbantunes profile image
João Antunes Author

Hey! Thanks!

Sorry for responding just now, didn't notice there was a comment 😐.

The OutboxPublisherFallbackBackgroundService ensures the OutboxFallbackPublisher runs from time to time.

As for ordering, yes, this wasn't something taken into consideration at this point, it would require some extra effort.

If we can avoid requiring message ordering, it's the best, not only because it makes things simpler, but in consequence of that, also more performant. Adding order into the mix will require much more work not only on the publishing side, but also the consumer side.