问题涉及使用两个使用主题消息在它们之间发送消息的android手机。如果他们都使用发送并拥有彼此的AID,他们可以很好地接收彼此的消息。但是当使用主题消息功能的发送时,它无法工作。
但是,我有一个桌面应用程序,可以毫无问题地从Android平台接收消息。但是android平台无法接收来自它们的消息。
我需要使用Android接收主题消息吗?
创建配置文件以连接到JADE时,主题管理服务的设置如下
profile.setProperty(Profile.SERVICES, "jade.core.messaging.TopicManagementFEService");
有关排除故障的任何建议吗?我使用嗅探器来查看这个并且消息不会在两个Android手机之间发送。但它肯定会被发送到PC应用程序。
在管理GUI的控制台中查看消息,因为我得到以下内容
May 25, 2013 2:21:25 PM jade.core.BackEndContainer messageOut
INFO: BE-192.168.1.114_55555-1@192.168.1.114 - Delivering OUT message INFORM, size=431
JADE Remote Agent Management GUI在桌面上运行,其中包含以下参数
java -cp .;%JADE_JARS% jade.Boot -gui -host %JADE_IP% -port %JADE_PORT% -nomtp -jade_domain_df_autocleanup true -services jade.core.messaging.TopicManagementService;jade.core.event.NotificationService;jade.core.mobility.AgentMobilityService;jade.core.event.NotificationService;jade.imtp.leap.nio.BEManagementService;
代理订阅具有以下代码的主题
public void subscribeTopic(String... topics)
{
for (String topic : topics)
{
TopicManagementHelper helper = (TopicManagementHelper) getHelper(TopicManagementHelper.SERVICE_NAME);
if (helper != null)
{
AID topicID = helper.createTopic(topic.toLowerCase());
try
{
helper.register(topicID);
this.subscribedTopics.add(topic.toLowerCase());
}
catch (ServiceException e)
{
logger.log(Level.SEVERE, "Could not subscribe to topic '" + topic + "'.", e);
}
}
}
}
这是使用TickerBehaviour
接收邮件的行为public void onTick()
{
boolean done = false;
String topic="location";
LocationData navupdate = readTopicMessageContent(topic, ACLMessage.INFORM, LocationData.class);
if (navupdate != null )
{
while (!done){
navupdate = myLocalAgent.readTopicMessageContent(topic, ACLMessage.INFORM, LocationData.class);
if (navupdate == null)
done = true;
}
}
block();
}
发送主题消息的代码是
public void sendTopicMessageContent(String topicName, int performative, Serializable object)
{
ACLMessage message = new ACLMessage(performative);
message.setOntology(object.getClass().getName());
message.setContentObject(object);
TopicManagementHelper helper = getTopicManager();
AID rcvr=helper.createTopic(topic.toLowerCase());
message.addReceiver(rcvr);
send(message);
}
答案 0 :(得分:1)
经过多次头发拉动和挫折之后,我修改了JADE下载中标题为主题的示例代码,以便与Android配合使用。这仍然无效。我将其发布到JADE电子邮件列表并收到以下回复。请注意以后参考版本是4.3.0版本
嗨,
实际上主题注册方式存在错误 分裂容器中的代理商得到了管理。
非常感谢此指示。
现在应该解决这个问题。为了得到你应该的修复 得到最后的JADE源(仅服务器端:jadeAndroid不是 从JADE SVN存储库中受到此修复的影响 重新编译整个。
如果您仍有问题,请告诉我们。
再见,乔瓦尼