You are not logged in.
Pages: 1
hello dears
is there a trick or a function that test if the message was sent or not
Nb: i use MaDKit 5.0.0.10
Offline
Hello,
First, I advice you to check the last version; 5.0.0.10 is quite old now.
sendMessage methods return a ReturnCode that gives this kind of information (cf. the madkit.kernel.AbstractAgent.ReturnCode javadoc)
So, for instance:
ReturnCode r = sendMessage(m,target);
if(r != ReturnCode.SUCCESS){
getLogger().info("there was a problem "+r);
}
But more simply, sendMessage methods are automatically logged.
So, for debugging purposes :
setLogLevel(Level.FINEST);//somewhere before
sendMessage(m,target);
will print out what the result is
Even more simply, if you are just interested in printing the ReturnCode only if there was a problem, use
getLogger().setWarningLogLevel(Level.FINE);//which is equal to the default log level of agents, so that warnings will be displayed when methods do not return SUCCESS
sendMessage(m,target);
Moreover, if the target is running on the same kernel, a SUCCESS also means that the message was safely delivered in the target's mailbox.
Offline
Thanks for your answer it woks very well
Offline
Pages: 1