[英]Protocol on Jade Agents with ACL
我想在两个代理之间(在不同平台上)开发一个协议,例如在 Agent1 和 Agent2 之间:
1.Agent1 send a message to Agent2 with a nonce
2.Agent2 receive the nonce, make a mathematic operation and then send to Agent1
3.Agent1 receive the message and sent Agent2 an ACK
所以我想创建一个 function 称为 doProtocol(Location fortune, int nonce) 并自动执行该过程
我知道如何发送或接收消息,但我找不到如何同时做到这一点任何人都可以帮助我吗?
我会使用 FIPA-RequestInteraction。
代理1,添加行为AchieveREInitiation。 在 PrepareRequest 中指定您的 function
prepareRequest(ACLmessage request)
{
request = getNonceMsg();
return request;
}
handleInform(ACLmessage reply)
{
//acknowledge response if you want to.
}
代理2,添加行为AchieveREResponder。 在 prepareResponse 中指定您的 function
prepareResponse(ACLmessage reply)
{
response = compileResponse(reply.getContent());
return response;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.