更多关于 External component & Data synchronization
2009年03月25日 2条评论
Access Model
DescriptionOpen
Any entity may subscribe to the node (i.e., without the necessity for subscription approval) and any entity may retrieve items from the node (i.e., without being subscribed); this SHOULD be the default access model for generic pubsub services.Presence
Any entity with a subscription of type "from" or "both" may subscribe to the node and retrieve items from the node; this access model applies mainly to instant messaging systems (see RFC 3921).Roster
Any entity in the specified roster group(s) may subscribe to the node and retrieve items from the node; this access model applies mainly to instant messaging systems (see RFC 3921).Authorize
The node owner must approve all subscription requests, and only subscribers may retrieve items from the node.Whitelist
An entity may subscribe or retrieve items only if on a whitelist managed by the node owner. The node owner MUST automatically be on the whitelist. In order to add entities to the whitelist, the node owner SHOULD use the protocol specified in the Manage Affiliated Entities section of this document, specifically by setting the affiliation to "member".
修正昨天说的。影响到PubSub External Component的应该有两种Access Model,就是上边所说的Presence和Roster。
不过我实在不知道把Publish Subscribe Service做成一个External Component有多大好处。我之前只是简单觉得,可以把它放在另外一台电脑上运行,而且不一定局限于连接Openfire XMPP Server,以后过度期间还可以连到ejabber啊之类的XMPP Server。
不过现在看来并不能简单得单一的作为一个External Component,因为一旦牵扯到Presence Subscription和Roster,就必须要相关的User data,而这些数据都储存在XMPP server上边,并不能是直接就可以想拿就拿来用的。
也不可能直接调用数据库!首先太慢!其次Server不一定立刻存储数据到数据库。
必须通过发送接收相应的XMPP packet来交换数据,实现数据同步。
现在想的,如果要用External Component,首先要写一个Internal PacketInterceptor Plugin,监视所有的Presence subscription Packet。因为Openfire server api里边没有presence handler处理这种Packet:
<presence to='juliet@example.com' type='subscribe'/>
不过倒是有IQHandler专门可以用来处理Roster add and delete packet:
<iq from='juliet@example.com/balcony' type='set' id='roster_2'> <query xmlns='jabber:iq:roster'> <item jid='nurse@example.com' name='Nurse'> <group>Servants</group> </item> </query> </iq>
所以同步Roster和Presence Subscription还是可以实现的,当然External Publish Subscribe component也就可以实现了。
只是不知道最后会不会太慢。
如果不用External Component,那就简单了,之前写的东西,修改一下,就可以用了。