我正在使用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