Jade Java代理通信 [英] Jade Java Agent Communication

查看:90
本文介绍了Jade Java代理通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为项目中的多个代理平台开发Jade。

I am working on jade for multiple agent platform in my project.

我有一个主容器和包含代理的代理容器。

I have a main container and agent container which contains agents.

我想将数据从座席发送到座席容器或主容器..

I want to send data from agent to agent container or main container ..

由于我的座席是一个客户,我的主容器将是服务器。

Since my agent is a client and my main container will be a server .

在玉器体系结构中,我理解代理容器将包含代理。

In the jade architecture i understood that agent container will contain agents.

这可能吗?

我想知道是否有API在代理之间发送数据。

I was wondering there are apis to send data among agents.

预先感谢

推荐答案

我不确定它是什么您正在尝试实现的目标。从JADE代理发送的ACLMessage的最终收件人是谁?是位于目标容器中的所有代理吗?

I am not sure what it is that you are trying to achieve. Who is the end reciepient of the ACLMessage that you are sending from the JADE agent? is it all the agents that reside in the targeted container?

需要澄清的是,容器本质上是代理可以驻留的地址,它本身并不是可以发布和接收消息的实体。在JADE框架中,代理为ACLMessages提供一个收件箱,基本上是一个BlockingQueue对象,其中包含收到的消息列表。代理能够观察自己的列表,并在其生命周期进行时对其进行处理。容器不具备此功能。

Just to clarify, a container is essentially an address where agents can reside, it is not an entitiy in of itself that can post and recieve messages. Within the JADE framework, Agents feature an 'Inbox' for ACLMessages, basically a BlockingQueue Object that contains a list of recieved messages. the agent is able to observe its own list and treat them as its lifecycle proceeds. Containers do not feature this ability.

可以通过添加收件人和其他详细信息将ACLMessage定向到特定的代理。接收消息的代理可以利用 MessageTemplate 侦听特定的ACLMessage,在这里您可以根据匹配条件从代理的收件箱中专门选择消息,例如:

ACLMessages can be directed at specific agents by adding receipients and other details. An Agent that is recieving messages can listen for specific ACLMessages by utilizing a MessageTemplate where you can specifically select messages from the agent's 'inbox' based on match criteria, for example :

Messagetemplate mt = MessageTemplate.MatchPerformative(ACLMessage.INFORM);
ACLMessage msg = myAgent.receive(mt);

允许代理从其收件箱中提取下一条ACLMessage.INFORM消息。

will allow the the agent to take the next ACLMessage.INFORM message from its'inbox'.

有关进一步的功能,我建议您通过玉器 API

for further abilities, I suggest you go through the jade API.

此外,对于我认为您要实现的目标,是向容器内的所有代理发送消息。您可以查询AMS代理以获取平台上的代理列表,然后通过 ContainerID 对其进行过滤。以下是一些入门的代码:

Also, for what i believe you are trying to achieve which is send a message to all agents within a container. You can query the AMS agent for a list of agents that is on the platform and then filter them by ContainerID. here is some code to get you started:

AMSAgentDescription[] agents = null;
SearchConstraints sc = new SearchConstraints();
// if multiple searchs are done, isolate them based on the name of searching agent
sc.setSearchId(getAID().getName());
sc.setMaxResults(new Long(-1)); // long value of -1 means get all agents
agents = AMSService.search(this, new AMSAgentDescription(), sc); //Query AMS agent for available agents

此代码将检索以下所有可用代理的列表向AMS代理注册的平台。祝您好运,如果有任何问题,请发贴:)

This code will retrieve a list of the all the available agents on platform that are registered with the AMS agent. Good luck and post if you have any issues :)

这篇关于Jade Java代理通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆