Discussion:
[jade-develop] agent communication
fatma chamekh
2014-08-29 13:19:22 UTC
Permalink
Hi all,
I am a little bit confused in the way to send message between agent. I
think there is two differents way : if agents are in the same container, or
if they are in differents containers.
should i use the same code in each case
like for exemple :(sure after registration in DF)

sender
ACLMessage msg = new ACLMessage(ACLMessage.INFORM);

msg.addReceiver(tet2o);
msg.setLanguage("StringLanguage");

msg.setContent(res.getLabel().toString());
msg.setDefaultEnvelope();

Receiver
ACLMessage msg = blockingReceive();
if (msg!=null System.out.println(getLocalName()+ " rx
msg"+msg.getContent());

I tried those instructions, it doesn't work.
I don't know what is wrong.
Thanks
Cliquez ici pour Répo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jade.tilab.com/pipermail/jade-develop/attachments/20140829/8fa6e745/attachment.html>
Caire Giovanni
2014-08-30 07:27:38 UTC
Permalink
Hi,

Yes! From the programming point of view communication is fully transparent with respect to the fact that the agents are in the same or in different containers.
Of course I suppose in the sender code you also call send(msg) ☺.

What do you mean by “it doesn’t work”?

You can use the Sniffer and the Introspector tools to investigate the problem:
The former lets you know if the message was actually delivered from the sender to the receiver.
The latter lets you see if the message is still pending in the receiver’s message queue.

Bye,

Giovanni

P.S. If you are dealing with agents living in different containers of the same platform and unless you have special requirements you don’t need to deal about the message Envelope --> msg.setDefaultEnvelope() is useless.

Da: jade-develop [mailto:jade-develop-bounces at avalon.tilab.com] Per conto di fatma chamekh
Inviato: venerdì 29 agosto 2014 15:19
A: jade-develop at avalon.tilab.com
Oggetto: [jade-develop] agent communication

Hi all,
I am a little bit confused in the way to send message between agent. I think there is two differents way : if agents are in the same container, or if they are in differents containers.
should i use the same code in each case
like for exemple :(sure after registration in DF)

sender
ACLMessage msg = new ACLMessage(ACLMessage.INFORM);

msg.addReceiver(tet2o);
msg.setLanguage("StringLanguage");

msg.setContent(res.getLabel().toString());
msg.setDefaultEnvelope();

Receiver
ACLMessage msg = blockingReceive();
if (msg!=null System.out.println(getLocalName()+ " rx msg"+msg.getContent());

I tried those instructions, it doesn't work.
I don't know what is wrong.
Thanks
[Loading Image...]

Cliquez ici pour Répo


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jade.tilab.com/pipermail/jade-develop/attachments/20140830/40960eb7/attachment.html>
Loading...