How to send a message from an Agent to Main Container in Jade?

179 views Asked by At

I am working on Agent-based web-application. Front-end send to the server parameters, those parameters I am sending to the specific agent as arguments.

        ContainerController ac = (ContainerController) runtime.createMainContainer(p);
        Object[] obj = {Amount};            
        try {   
            

            AgentController ag = ac.createNewAgent("a1","agents.a1", obj);//arguments
            ag.start();
            AgentController ag2 = ac.createNewAgent("a2","agents.a2", obj);//arguments
            ag2.start();
            
            
            } catch (StaleProxyException e) {
                throw new Error(e);
            }

After receiving these parameters, each agent is required to send receipt confirmation in order to send it to the web-application frond-end. How can I send parameters from agents to the main container implementer.

How can it be implemented? If there are more feasible way to do it, it is also welcomed

1

There are 1 answers

0
Hc. On
  1. Except in exceptional cases, which does not seem to be the case here, agents do not "communicate" with containers (a container is not an agent, so it is not possible to send it a message).

  2. Your agents should contact the web application directly. Since the objective here is that they use a web-service, you can select a standard REST library and make a "post". If you do not want all your agents to know the location of the web-service, then create a new agent that will play the intermediary.