Java 将GAE XMPP服务作为现有XMPP服务器(例如ejabberd或OpenFire)的外部组件实现
我想知道你们使用什么集成技术来实现现有XMPP服务器的外部组件(例如ejabberd或OpenFire)。是通过向另一个发送xmpp消息吗user@externaldomain直接或使用类似urlfetch的机制?应用程序引擎支持非常有限的XMPP子集。基本上,您可以发送消息(通过API),也可以接收消息(它们以HTTP请求的形式出现)Java 将GAE XMPP服务作为现有XMPP服务器(例如ejabberd或OpenFire)的外部组件实现,java,google-app-engine,xmpp,openfire,Java,Google App Engine,Xmpp,Openfire,我想知道你们使用什么集成技术来实现现有XMPP服务器的外部组件(例如ejabberd或OpenFire)。是通过向另一个发送xmpp消息吗user@externaldomain直接或使用类似urlfetch的机制?应用程序引擎支持非常有限的XMPP子集。基本上,您可以发送消息(通过API),也可以接收消息(它们以HTTP请求的形式出现) 您可以在现有的XMPP服务器上安装一个外部组件,用您的应用程序引擎代码发送和接收消息。该组件必须跟踪您希望从应用程序发送和接收的任何内容。谷歌应用程序引擎(
您可以在现有的XMPP服务器上安装一个外部组件,用您的应用程序引擎代码发送和接收消息。该组件必须跟踪您希望从应用程序发送和接收的任何内容。谷歌应用程序引擎(Gae)与客户端一样支持XMPP 使用XMPP功能,您可以: 发送消息
JID jid = new JID("youraccount@jabber.org");
Message msg = new MessageBuilder()
.withRecipientJids(jid)
.withBody("Hello i'm a fancy GAE app, how are you?")
.build();
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
if (xmpp.getPresence(jid).isAvailable()) {
SendResponse status = xmpp.sendMessage(msg);
}
public class XMPPReceiverServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException {
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Message message = xmpp.parseMessage(req);
JID fromJid = message.getFromJid();
String body = message.getBody();
//Save to Big Table
}
}
接收信息
JID jid = new JID("youraccount@jabber.org");
Message msg = new MessageBuilder()
.withRecipientJids(jid)
.withBody("Hello i'm a fancy GAE app, how are you?")
.build();
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
if (xmpp.getPresence(jid).isAvailable()) {
SendResponse status = xmpp.sendMessage(msg);
}
public class XMPPReceiverServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException {
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Message message = xmpp.parseMessage(req);
JID fromJid = message.getFromJid();
String body = message.getBody();
//Save to Big Table
}
}
记住,JIDs可能只是yourappid@appspot.com或foo@yourappid.appspotchat.com
因为谷歌域名还不受支持
例如,您可以用一个简单的页面制作一个玩具Gae应用程序,其中包含:
看看XMPP,了解它是如何工作的。“实现外部组件”?你想实现什么?gae不能使用xmpp,所以我考虑安装外部openfire并使用pubsub。我的smack pubsub客户端将安装在外部服务器上,以及关于如何将外部xmpp与gae结合使用的任何文章/参考资料?您不需要做任何特殊的事情来与来自xmpp的组件交谈。您只需像以前一样使用jid发送/接收消息。请注意,这就是GAE XMPP所能做的一切。您的高级组件必须位于您运行的另一台服务器上。@SystemPuntoot,您能对这篇文章发表评论吗