Search code examples
javaeclipseraspberry-piagents-jademulti-agent

two containers in Jade and communication between different devices


I am currently studying Jade. I found that there was only a little information about Jade. May I ask two questions?

  1. How to build a second container in Eclipse or Netbeans?
  2. How to enable communication between two different devices, such as one computer and one raspberry pi?

Solution

    1. Regarding container creation (assuming you already have a main container somewhere):

      Runtime rt = Runtime.instance();
      String containerName;
      ProfileImpl pContainer;
      ContainerController containerRef;
      
      //create the container
      containerName="Mycontainer1";
      pContainer = new ProfileImpl(PLATFORM_IP, PLATFORM_PORT, PLATFORM_ID);
      pContainer.setParameter(Profile.CONTAINER_NAME,containerName);
      
      //link it to the platform
      System.out.println("Launching container "+pContainer);
      containerRef = rt.createAgentContainer(pContainer);
      

      For a fully working example: https://startjade.gitlab.io/CreatePlatform/

    2. If the devices can communicate freely and you want them to be part of the same jade instance, just deploy a container on the pi (for example), and make it connect to the mainContainer on your computer. The agents on the platform will then be able to communicate with each other regardless of their location.