Forget about the Sniffer for one moment.
Each JADE container has an internal pool of threads responsible to deliver messages sent by the agents living in the local container.
The delivery mechanism ensures that messages for the SAME RECEIVER are delivered in the same order they are enqueued to the pool.
If (regardless of who the sender is) m1 for A is enqueued before m2 for A --> A receives m1 before m2.
If m1 for A is enqueued before m2 for B, there is NO guarantee that A receives m1 before B receives m2.
Now let's consider the sniffer. Notifications to the sniffer are produced just before enqueuing messages to the delivery pool. Since such notifications have the same receiver (the sniffer agent) they are delivered in the order they are produced. Of course each agent has its own Thread and how the JVM schedules threads is not under your control --> If A calls send(m1) and IMMEDIATELY after B calls send(m2), a Thread switch may occur so that m2 is enqueued to the delivery pool (and notified to the sniffer) before m1.
Finally note that if m1 and m2 are sent by two agents living in different containers (different JVM and possibly different hosts) there is absolutely NO time constraint regardless of the receiver since two different delivery pools are responsible for delivering the messages.
Oggetto: Re: R: [jade-develop] Sniffer and JavaSniffer, problem with the order in sniffed messages
Ok, I understand the explanation about the jade delivery policy: in fact in my scenario agent A sends n messages to n different agents (B1, B2...), that will answer to these messages, but sometimes the sniffer shows the answers of the Bn agents "interlined" with the first messages of A (even if the messages are not really delivered in that order).
1) considering an agent, its messages will be delivered in the same order they were sent
2) considering 2 or more agents, there no assurance that if A sends m1 and then B sends m2, m1 will be delivered before m2.
agents: it seems to me that for agents the relative order of m1 and m2 is respected, and that the problem is only of the Sniffer. Is it true?
To cope with this I will try with your second solution: the first would be fine to check offline the execution, after it, but for the online check, in real time, I could not do it, because the Sniffer can't know that it will receive a message that should have been displayed before those already received (even if there is a timestamp in the message), unless for example it waits some seconds before showing messages.
Post by Caire GiovanniHi,
When sniffed agents send/receive messages additional messages are sent
to the Sniffer to inform it about the exchanged messages. Such
additional messages are sent to the Sniffer in the correct order when an explicit order exists.
E.g. if A sends m1 and then m2, the sniffer is informed about m1 and
then m2 and (since message delivery in JADE is designed to preserve
message ordering) the sniffer will show m1 and then m2.
On the other hand if A sends m1 and just after that B (possibly living
in a different container) sends m2, there is absolutely no guarantee
that the sniffer receives m1 and then m2.
Unfortunately the JavaSniffer code is not available since it was
donated to the Community in executable form only. Anyway it exploits
the same mechanism used by the normal sniffer and therefore I'm afraid
you would experience the same "problem".
- Add a time stamp to all the messages sent by your agents (a.g. as a
user defined parameter) and modify the sniffer code to show messages
in an order that reflects these time stamps (modifications should not
be too difficult and should be limited to the MessageList and Message
class included in the jade.tools.sniffer package).
- Create a Jade kernel service that intercepts all messages exchanged
by your agents and creates an ad hoc report according to your needs.
How to create a JADE kernel service that intercepts agent messages is
quite easy and is described in chapter 7 of the book Developing Multi Agent Systems with JADE.
Bye,
Giovanni
-----Messaggio originale-----
Da: jade-develop-bounces at avalon.tilab.com
[mailto:jade-develop-bounces at avalon.tilab.com] Per conto di Daniela Briola
Inviato: mercoled? 15 gennaio 2014 19:40
A: jade-develop at avalon.tilab.com
Oggetto: [jade-develop] Sniffer and JavaSniffer, problem with the order in sniffed messages
Hi all,
I'm a university researcher and I'm trying to use the Jade Sniffer to
check if messages among my agents are exchanged in a specific order,
to test my MAS in a "non intrusive way".
Using the Sniffer is ok but unfortunately often messages are shown by
the Sniffer in a wrong order (not only are shown, if I'm not wrong
they are not sent to the sniffer in the correct order), so many times
this control goes wrong even if the real messages flow is correct.
Are you aware of some "workaround" to avoid/solve this problem (apart
from changing the agents code to wait a little between a message and
the next one)?
I could also modify the Sniffer/AMS source if needed, but I suppose
that it is not so simple/fast: anyway, with some suggests or guide
lines, I could try if it is the only solution!
I also found the JavaSniffer, but I can't use it because it does not
is there any similar add on / solution that I can try? or, while I'm
searching for a 32bit platform to test it, can you tell me please 1)
if with this add-on the real messages sequence is respected and 2) if
the source code is available (it seems not, true? Because the next
step in my work could request to change the source code, and if it is not available/open I'll give up now with it).
Thank you in advance,
Best regards
Daniela Briola
_______________________________________________
jade-develop mailing list
jade-develop at avalon.tilab.com
https://avalon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT
http://jade.tilab.com/community-mailinglist.htm
Questo messaggio e i suoi allegati sono indirizzati esclusivamente
alle persone indicate. La diffusione, copia o qualsiasi altra azione
derivante dalla conoscenza di queste informazioni sono rigorosamente
vietate. Qualora abbiate ricevuto questo documento per errore siete
cortesemente pregati di darne immediata comunicazione al mittente e di
provvedere alla sua distruzione, Grazie.
This e-mail and any attachments is confidential and may contain
privileged information intended for the addressee(s) only.
Dissemination, copying, printing or use by anybody else is
unauthorised. If you are not the intended recipient, please delete
this message and any attachments and advise the sender by return e-mail, Thanks.