Class KafkaActorServer

java.lang.Object
com.scivicslab.pojoactor.core.distributed.KafkaActorServer
All Implemented Interfaces:
AutoCloseable

public class KafkaActorServer extends Object implements AutoCloseable
Server-side component that receives actor messages from Kafka and dispatches them to the local ActorSystem.

Consumes from pojo-actor.{myNodeId}.inbox, dispatches each message to the named local actor, and — when the message has a replyTo — publishes the result to pojo-actor.{replyTo}.replies.

Lifecycle


 KafkaActorServer server = new KafkaActorServer(actorSystem, myNode, "kafka:9092");
 server.start();   // begins consuming in a virtual thread
 // ...
 server.close();   // stops the consumer loop
 
Since:
3.1.0
  • Constructor Details

    • KafkaActorServer

      public KafkaActorServer(ActorSystem actorSystem, NodeInfo myNode, String brokers)
      Creates a KafkaActorServer.
      Parameters:
      actorSystem - the local actor system to dispatch messages to
      myNode - this node's identity (determines which inbox topic to consume)
      brokers - Kafka bootstrap servers (e.g. "kafka:9092")
  • Method Details

    • start

      public void start()
      Starts the inbox consumer loop in a virtual thread. Safe to call only once.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable