[英]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.