获取玉器容器中的代理列表

Getting list of agents in container in jade

如何在 java 的 jade 指定容器中获取代理列表(它们的名称如 "da0@ip" 等)?我看过了,唯一能找到的是所有容器中所有代理的列表。我不是很喜欢玉石,这只是一个学校项目,所以任何建议都会有所帮助。

您可以尝试使用AMS代理,即向其发送请求并处理响应。类似于:

QueryAgentsOnLocation ca = new QueryAgentsOnLocation();
ca.setLocation(...); // here is the information about you ontainer
Action actExpr = new Action(myAgent.getAMS(), ca);

ACLMessage request = new ACLMessage(ACLMessage.REQUEST);
request.addReceiver(myAgent.getAMS());
request.setOntology(JADEManagementOntology.getInstance().getName());
request.setLanguage(FIPANames.ContentLanguage.FIPA_SL);
request.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
myAgent.getContentManager().fillContent(request, actExpr);
myAgent.send(request);