akkadotnet/Akka.Streams.Kafka

Error handling

Eye-zz opened this issue · 0 comments

Every time there is an error I'd like to:

  • log this error
  • drop the message
  • continue with the stream

I've tried to use WithAttributes(ActorAttributes.CreateSupervisionStrategy(Decider)) but with no success. In your test suite there is some code I copied/pasted. But I got the following error:

'Directive decider(Exception)' has the wrong return type (CS0407)

My code is as follows:

Directive decider(Exception cause) => cause is NullReferenceException ? Directive.Resume : Directive.Stop;
source.WithAttributes(ActorAttributes.CreateSupervisionStrategy(decider));

What is the good practice to log an error and resume the stream?
In your source code I can see a consumeErrorHandler but I don't know how to use it.
Thanks.