Class AgentModule

java.lang.Object
com.rpl.agentorama.AgentModule
All Implemented Interfaces:
com.rpl.rama.RamaModule

public abstract class AgentModule extends Object implements com.rpl.rama.RamaModule
Base class for creating agent modules that can be deployed to a Rama cluster. Alternatively, a regular RamaModule can be defined with an AgentTopology explicitly created to add agents to it. Agent modules are deployable units containing agent definitions, stores, and objects. They extend RamaModule and provide a simplified interface for defining agents and their associated infrastructure. The topology provides the configuration context for: Example:

 public class MyAgentModule extends AgentModule {
   @Override
   protected void defineAgents(AgentTopology topology) {
     topology.declareKeyValueStore("$$myStore", String.class, Integer.class);

     topology.newAgent("myAgent")
             .node("start", "process", (AgentNode agentNode, String input) -> {
               KeyValueStore<String, Integer> store = agentNode.getStore("$$myStore");
               store.put("key", 42);
               agentNode.emit("process", "Hello " + input);
             })
             .node("process", null, (AgentNode agentNode, String input) -> {
               agentNode.result("Processing: " + input);
             });
   }
 }
 
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.rpl.rama.RamaModule

    com.rpl.rama.RamaModule.Setup, com.rpl.rama.RamaModule.Topologies
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    define(com.rpl.rama.RamaModule.Setup setup, com.rpl.rama.RamaModule.Topologies topologies)
     
    protected abstract void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.rpl.rama.RamaModule

    getModuleName
  • Constructor Details

    • AgentModule

      public AgentModule()
  • Method Details

    • defineAgents

      protected abstract void defineAgents(AgentTopology topology)
    • define

      public void define(com.rpl.rama.RamaModule.Setup setup, com.rpl.rama.RamaModule.Topologies topologies)
      Specified by:
      define in interface com.rpl.rama.RamaModule