zarusz / SlimMessageBus

Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.
Apache License 2.0
467 stars 78 forks source link

#275 Notify outbox service that a message is available for publishing #276

Closed EtherZa closed 2 months ago

EtherZa commented 2 months ago

On sending a message to the outbox, the OutboxForwardingPublishInterceptor will notify the OutboxSendingTask that a publishing loop should begin. If the OutboxSendingTask is already publishing messages, the notification will be ignored.

The notification is only accepted if the service is currently active.

The original PollIdleSleep configuration is still used should no notification be received. The sleep timer is both a fail safe for the process and will initiate publishing in a distributed environment (no cross app communication available).

Note: notifications are sent from OutboxForwardingPublishInterceptor on disposal so as to ensure they are raised only once any transactions have been completed.

EtherZa commented 2 months ago

I've updated the ASB tests to provision unique topic/queue names per execution (with a 5 min auto-delete on idle). I think that just leaves the Kafka tests as being a little flakey now.

zarusz commented 2 months ago

@EtherZa good feature and set of changes!

I've left some minor feedback. Once you address and are ready then I am happy to merge.

On the Kafka topic creation, we would have to implement this feature #110 to make this work.

EtherZa commented 2 months ago

@zarusz Thanks for the feedback. I've fixed the typo (and made the change in the _t.md). The current AsyncManualResetEvent implementation looks to have a lower impact than a SemaphoreSlim variant (benchmark on comment).

Please let me know if you would like the default idle timeout to change and/or if you come across anything else. Otherwise, I think that it is good to go from my perspective.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
82.3% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud