2

A tool I am working on requires reliable delivery of events between participating entities.

In the .NET/F# eventing infra (i.e. Event<>/IEvent<>), framework does not guarantee that all event handlers will be called. E.g. crash in one handler may crash the entity firing the events and prevent other handlers from being called.

I understand the reason why framework cannot guarantee that viz. it wouldn't have enough knowledge required to catch/bubble/propagate application exceptions.

However for my app, I am thinking of writing a 'derivative' of the Event<>/IEvent<> infra to [a] prevent handler exceptions from bubbling up [b] guaranteeing all handlers are called [c] fits well with the language

I have said 'derivative' as I don't have a design in mind yet. So few questions before I start:

Have folks done something like this before? Is there a better way to achieve my goals?

R4n D3v
  • 63
  • 4
  • 2
    you might find it very difficult to *guarante* it - you will not catch stack-overflows, infinite-loops, ... no matter what – Random Dev Jun 03 '15 at 07:57
  • 1
    Sounds like an actor framework might suit your needs: http://getakka.net/docs/concepts/supervision – Matthew Mcveigh Jun 03 '15 at 08:32
  • 1
    You should also consider using IObservable (which IEvent implements) with the Reactive Extensions. – Kevin Jun 03 '15 at 08:43

1 Answers1

0

If you want guaranteed delivery of messages (events), you'll need to put them on a persistent pub/sub system (such as RabbitMQ, Azure Service Bus, etc.).

With persisted messages, subscribers can handle messages independently of each other. If one subscriber crashes, it still gets a chance to retry later, and it doesn't affect any other subscribers.

Mark Seemann
  • 225,310
  • 48
  • 427
  • 736