Class RemoteActorRef
java.lang.Object
com.scivicslab.pojoactor.core.distributed.RemoteActorRef
- All Implemented Interfaces:
CallableByActionName
Reference to an actor hosted on a remote node.
Implements CallableByActionName and translates method calls into
messages delivered via the configured TransportLayer.
Usage Example (HTTP transport)
RemoteActorRef remoteMath = new RemoteActorRef("math", nodeInfo);
ActionResult result = remoteMath.callByActionName("add", "5,3");
Usage Example (Kafka transport)
KafkaTransport transport = new KafkaTransport(myNode, "kafka-broker:9092");
RemoteActorRef remoteMath = new RemoteActorRef("math", nodeInfo, transport);
ActionResult result = remoteMath.callByActionName("add", "5,3");
- Since:
- 3.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteActorRef(String actorName, NodeInfo nodeInfo) Constructs a RemoteActorRef using the default HTTP transport.RemoteActorRef(String actorName, NodeInfo nodeInfo, TransportLayer transport) Constructs a RemoteActorRef with an explicit transport layer. -
Method Summary
Modifier and TypeMethodDescriptioncallByActionName(String actionName, String args) Invokes an action on the remote actor and waits for the result.toString()
-
Constructor Details
-
RemoteActorRef
Constructs a RemoteActorRef using the default HTTP transport.- Parameters:
actorName- the name of the remote actornodeInfo- information about the node hosting the actor
-
RemoteActorRef
Constructs a RemoteActorRef with an explicit transport layer.- Parameters:
actorName- the name of the remote actornodeInfo- information about the node hosting the actortransport- the transport to use for message delivery
-
-
Method Details
-
callByActionName
Invokes an action on the remote actor and waits for the result.- Specified by:
callByActionNamein interfaceCallableByActionName- Parameters:
actionName- the name of the action to invokeargs- the arguments for the action- Returns:
- the result of the action execution
-
getActorName
-
getNodeInfo
-
getTransport
-
toString
-