Giter VIP home page Giter VIP logo

Comments (6)

He-Pin avatar He-Pin commented on May 26, 2024

like add a invoker to props
and then :

  private def processElement(element: T) = {
props.invoker.invoke{
    producer.send(props.encoder.toBytes(element), props.partitionizer(element))
}
  }

from alpakka-kafka.

kciesielski avatar kciesielski commented on May 26, 2024

You can supervise a KafkaActorSubscriber and prevent it from restarting using code like this:
https://github.com/softwaremill/reactive-kafka/blob/master/src/test/scala/examples/examples.scala#L40
It's not perfect and I'm hoping get this refined but I guess that it can should work for now.

from alpakka-kafka.

He-Pin avatar He-Pin commented on May 26, 2024

yes I just found the refactory here
#23
will close it for now.

from alpakka-kafka.

kciesielski avatar kciesielski commented on May 26, 2024

There's another way to handle subscriber errors:

   val sinkDecider: Supervision.Decider = {
      case _ => Supervision.Resume // Your error handling
    }

    Source(publisher)
      .map(_.message().toUpperCase)
      .to(Sink(subscriber).withAttributes(ActorAttributes.supervisionStrategy(sinkDecider)))
      .run()

from alpakka-kafka.

He-Pin avatar He-Pin commented on May 26, 2024

@kciesielski once I realized that I could return the props ,I just attach it as a child actor and the override the supervison strategy.
but from the doc,said that:

ZipWith, FlexiMerge, FlexiRoute junction, ActorPublisher source and ActorSubscriber sink components do not honour the supervision strategy attribute yet.

will the solution you described here works?

from alpakka-kafka.

kciesielski avatar kciesielski commented on May 26, 2024

@hepin1989 Thanks for finding this :) Indeed, I wrote some tests and looks like this decider will never be called. So it looks like the only way to catch exceptions now is to use something similar to the method described in the ReactiveKafkaIntegrationSpec:"close producer, kill actor and log error when in trouble" test.
I'll update the examples and documentation accordingly.

from alpakka-kafka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.