Akka streams with an Akka cluster

My acc-learn-o-thon streams go on. I would like to integrate akka-streams application with akka-cluster and DistributedPubSubMediator .

Adding support for publishing is pretty straight forward, but I’m having problems in the "Subscription" section.

For reference, the subscriber is listed below in Sampleafe :

class ChatClient(name: String) extends Actor {
  val mediator = DistributedPubSub(context.system).mediator
  mediator ! Subscribe("some topic", self)

  def receive = {
    case ChatClient.Message(from, text) =>
      ...process message...
  }
}

My question is: how can I integrate this actor with my stream, and how should I guarantee that I receive public messages in the absence of backpressure of the stream?

I am trying to run a pubsub model where one thread can post a message and another thread will consume it (if it is signed).

+4
3

YouTube. , .

+2

: ActorPublisher, 2.5.0.

For those interested in the current approach, Colin Breck wrote a wonderful series on his blog about the integration of chord actors and Akkas. Over the course of the series, Brek forms a system that begins with Akka streams and ordinary actors, then includes the Akka cluster and Akka's tenacity. The first message in the series is here (a fragment of distributed flow processing is in part 3 ).

0
source

Source: https://habr.com/ru/post/1627089/


All Articles