Interface ActorSystemAware


public interface ActorSystemAware
Interface for actors that need access to the IIActorSystem.

When a class implements this interface and is loaded as a plugin via DynamicActorLoaderActor, the actor system will be injected after construction, allowing the plugin to query other actors.

Example usage in a plugin:


 public class MyPlugin implements CallableByActionName, ActorSystemAware {
     private IIActorSystem system;

     @Override
     public void setActorSystem(IIActorSystem system) {
         this.system = system;
     }

     @Override
     public ActionResult callByActionName(String actionName, String args) {
         // Can now query other actors
         IIActorRef<?> nodeGroup = system.getIIActor("nodeGroup");
         ActionResult result = nodeGroup.callByActionName("getSessionId", "");
         String sessionId = result.getResult();
         // ...
     }
 }
 
Since:
2.12.0
Author:
devteam@scivicslab.com
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sets the actor system reference.
  • Method Details

    • setActorSystem

      void setActorSystem(IIActorSystem system)
      Sets the actor system reference.

      This method is called automatically by DynamicActorLoaderActor after the plugin is instantiated, if the plugin implements this interface.

      Parameters:
      system - the actor system managing this plugin