我正在使用Spring集成xmpp模块编写连接到GCM云服务的第三方服务器的自定义实现,如GCM Cloud Connection Server (XMPP)中所述。Spring集成XMPP和Google Cloud Messaging
到目前为止,我已经成功地连接到服务器GCM,但是当我发送邮件到我结束了类似的服务器:
<message id="m-1366082849205" to="REGISTRATION_ID">
<body>{"hello":"world"}</body>
</message>
,但我需要发送这样的事情:
<message id="">
<gcm xmlns="google:mobile:data">
{
"to":"REGISTRATION_ID",
"message_id":"m-1366082849205"
"data":
{
"hello":"world",
}
}
</gcm>
</message>
我用的是最新版本的SI,4.0.4,这是我在xml配置:
<int-xmpp:outbound-channel-adapter
id="gcmOutboundAdapter" channel="gcmOutboundNotificationChannel"
xmpp-connection="gcmConnection" auto-startup="true"/>
我与平时MessageBuilder这样发送消息:
Message<String> xmppOutboundMsg = MessageBuilder.withPayload(xmppPayload)
.setHeader(XmppHeaders.TO, REGISTRATION_ID)
.build();
其中xmppPayload是一个JSON字符串。
我需要配置/重写xmpp消息的组成方式,实现结果的最佳做法是什么?我是否应该使用自定义服务激活器覆盖实现int-xmpp:outbound-channel-adapter的类,是否有配置xmpp消息组成的方式?
感谢您的任何帮助。
你可以看一下[我的问题](http://stackoverflow.com/questions/28854835/what-are-the-right-parameters-for -xmpp-connection-spring-integration-to-make-i)并可能有帮助? – hamid 2015-03-05 03:25:01