Receivers

Author: Tiziana Trucco (TILab S.p.a)
Date: 15/05/2001

By this example the user can learn about the agent comunication mechanism provided by jade platform. It shows the implementation of two agents that, respectively, send and receive messages using different types of framework comunication primitives ( blocking and not blocking ). Moreover it gives an example of the use of message templates for filtering agent incoming messages.

 

AgentReceiver
Description:
The AgentReceiver shows different ways to receive messages. It implements a FSM behaviour with three states  (relative to three operations op1,op2,op3) each corresponding to a different receive method. In op1 a simple receive() method is used .If  the Agent receives a message it  prints the same and changes its state (op2), otherwise invokes the block() method (see the programmer  guide for more details on block method) and remains in  the previous state. In op2  a blockingReceive() method is used. It blocks the Agent Receiver until a right message is received or a timeout is elapsed and then the next state (op3) is reached. When  the Agent is performing op3 the blockingReceive() method blocks it until  the  message specified in MessageTemplate  is received.When this happens the Agent gets  the initial state. The figure describes the state diagram of this agent
Jade classes used:
SimpleBehaviour, MessageTemplate, ACLMessage
Source
\src\examples\receivers\AgentReceiver.java

 

AgentSender
Description:
The behaviour of this agent ( that extends a simple behaviour ) consists in a continous sending of INFORM messages. The user has to insert the receiver agent identifier at the prompt to start this example.
Jade classes used:
Simplebehaviour, ACLMessage
Source
\src\examples\receivers\AgentSender.java

 


JADE is a trademark of CSELT. JADE has been developed jointly by CSELT and the Computer Engineering Group of the University of Parma