Tutorial 2. JADE Containers, Local and Remote

This tutorial shows how to add local and remote containers to a JADE platform. As before, DummyAgent and PingAgent are used to demonstrate agent communication.

Multiple Containers on One Computer

As in Tutorial 1, open a DOS/Command window,and use runjade.bat as done in Tutorial 1.

runjade -gui -host Frodo
(The local name for the computer is Frodo. You don't really need the -host flag here. But ...)

If you are using computers in different domains you would want to include the full host name to prevent JADE from just using localhost. For example,

runjade -gui -host frodo.scs.ryerson.ca

Display the container tree in the RMA agent window. You see the main container with the df, ams and RMA agents.

Now open another DOS/Command window. In that window we create a satellite container and put the PingAgent in it.

runjade -host Frodo -container ping0:examples.PingAgent.PingAgent

Notes on the syntax

Try out the agents

Display the RMA window you will see an entry "container-1" added. Expanding the tree shows the ping0 agent.

Invoke the DummyAgent and use it to send a message to ping0 in the same way as was done in Tutorial 1. (Fill in the receivers=ping0@Frodo:1099/JADE, communicative act=QUERY-REF, Content=ping) If you examine the return message it is the same as in Tutorial 1, namely "(pong)" or "alive", depending on your JADE version..

Try changing the commutative act to INFORM and send the message to ping0. You will get a NOT-UNDERSTOOD reply. Look at the content of this message for an example of the SL language constructed by JADE.

Remote Containers

So far, this tutorial is just a repeat of Tutorial 1. It is not surprising to find that you can send messages from agent to agent on the same platform whether they are in different containers or not. More interesting is that JADE is a distributed system. A platform can have containers on remote systems as well as locally. So if you have a second computer networked to the first, try this.

On the second computer set up and run a JADE container with a PingAgent in it. In other words, simply, type,

runjade -host Frodo -container ping1:examples.PingAgent.PingAgent.

This is exactly the same command as used above to create a container on machine Frodo itself! Thanks to RMI, the system is transparent with respect to hosts. Notice that, since an agent nicknamed ping0 already exists on this platform, I must use a different nickname for this second PingAgent, even though the new agent is running on a different machine.

Looking on the original machine (Frodo in my case) I see that a new container, Container-2 has appeared on the RMA agent window in which ping1 is listed. I can, once again, send the usual message from the DummyAgent on Frodo to ping1 which lives on another machine (named IBM in my case). The location of ping1 is transparent to the user of RMA on Frodo. It could be anywhere.

The container on the other computer is a client of the RMI server running on Frodo. So is ping0 a client which happens to exist on the same machine as the RMI server itself.

Running an RMA (Remote Monitoring Agent) with a container

If you have followed the tutorial to this point you have a main JADE platform on one machine (Frodo in my case). This machine is the home of the Main Container and the RMI server. A second container, Container-1 is installed on this machine and contains one agent, ping0@Frodo:1099/JADE, to give it its full name. On a second machine, IBM in my case, there is a second container, Container-2 containing one agent, ping1@Frodo:1099/JADE. This agent lives on machine IBM but "belongs" to the platform running on machine Frodo.

A user on machine IBM can't see anything or do anything. The user of machine Frodo is in complete control. It would be nice to run an RMA agent and a DummyAgent on a machine remote from the platform machine.

To do this we need to know the fully qualified names of Dummy agent and RMA agent. These are,

So start another container with these two agents and yet another ping agent, ping2, on some machine connected to the JADE platform machine. For example,

runjade -host Frodo -container dummy0:jade.tools.DummyAgent.DummyAgent RMA1:jade.tools.rma.rma

(Don't forget to include a nickname for your agents! AND make sure the names don't clash with names on other containers on the platform. Note RMA1 not RMA.)

You will get the windows for the two agents on the remote machine. RMA1 will show all the containers and agents on the platform, just like RMA on the main platform server. Try sending one of the ping agents the usual message from dummy0.

Note