更多关于 External component & Data synchronization

Access Model
Description

Open
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,那就简单了,之前写的东西,修改一下,就可以用了。

麻烦的External Component Roster Access问题

因为在External Component里边没法用一般的Roster query。又只能自己写一个Roster query packet handler之类的了。

不过看了一下,仿佛XEP-0144: Roster Item Exchange可以部分满足我的要求。虽然这个protocol externsion在Openfire里边没有支持,但是我可能还是照着这个写一个Internal component或者Packet handler plugin比较好,尽量少做修改。

麻烦啊!!把PubSub弄成External Component无限麻烦,因为Publish subscribe里边的Presence Access Model需要用到Roster,这就要跟牵扯到如何获取Roster,如何同步XMPP Server的Roster跟External Component的Roster的问题。要不然就将就用Internal Component算了?!?!省的我浪费几个月时间写PubSub component。

WindChime

最终名字定为WindChime,之前叫Beacon…
 
后来觉得不咋样,而且发现Facebook之前也有一个同样名字的Project,结果fail了。
换名字是肯定的了。
 
思考了很长时间,决定敲定WindChime,风铃。
虽然中文有点俗,但是还算贴切!
 
之前的试验品弄完了!现在开始最终开发咯!
好的名字好的开始是必要的!!!
WC万岁!哇哈哈哈哈!