No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0040.xml 23KB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM "xep.ent">
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type="text/xsl" href="xep.xsl"?>
  7. <xep>
  8. <header>
  9. <title>Jabber Robust Publish-Subscribe</title>
  10. <abstract>Note: This proposal has been superseded by XEP-0060; please refer to that document for the successor protocol.</abstract>
  12. <number>0040</number>
  13. <status>Retracted</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies/>
  17. <supersedes/>
  18. <supersededby><spec>XEP-0060</spec></supersededby>
  19. <shortname>None</shortname>
  20. <author>
  21. <firstname>Tim</firstname>
  22. <surname>Carpenter</surname>
  23. <email></email>
  24. <jid></jid>
  25. </author>
  26. <revision>
  27. <version>0.2</version>
  28. <date>2004-07-26</date>
  29. <initials>psa</initials>
  30. <remark>Formally retracted this proposal in favor of XEP-0060: Publish-Subscribe.</remark>
  31. </revision>
  32. <revision>
  33. <version>0.1</version>
  34. <date>2002-08-02</date>
  35. <initials>tc</initials>
  36. <remark>Initial Release For Comment</remark>
  37. </revision>
  38. </header>
  39. <section1 topic="Introduction">
  40. <p><em>Note: This XEP has been superseded by &xep0060;; please refer to that document for the successor protocol.</em></p>
  41. <p>This document introduces and lays out a preliminary protocol for a robust form of publish-subscribe over the Jabber messaging environment -- Jabber Robust Publish Subscribe (JRPS).</p>
  42. <p>Implementation issues in the environment are appended, covering Permissioning and Contributions. Both are likely to require separate XEPs, but need to be constructed sympathetically.</p>
  43. <p>In creating this addition, I have an underlying philosophy to sustain a "fractal" world of publish-subscribe components, such that a subscriber to a pubsub component may well be a pubsub component in itself, representing its own community of subscribers. This will allow Jabber to support organic scalability found on other platforms.</p>
  44. <section2 topic="Background">
  45. <p>Publish-Subscribe and other messaging environments that exist are often classified as providing one or more of the following three levels of service.</p>
  46. <ol>
  47. <li>Best Try, where data may on rare occasions get lost. Small footprints and ultimate performance are the aim where the impact of occasional data loss in business, legal, confidential or other terms is not significant compared with the core priority of performance.</li>
  48. <li>Robust, where non-delivery of data can be detected and recovered by recipients and that the sequence, integrity and completeness of data can be ascertained with a high level of confidence. Non-delivery of data would have a significant and lasting negative impact on the quality and integrity of the data.</li>
  49. <li>Transactional, where there is an absolute, mission-critical need to ensure that all communication flow is guaranteed and if problems occur during a set of connected steps, then the situation can be rolled back (reversed) to the state before the operation commenced.</li>
  50. </ol>
  51. <p>This document concerns itself with level 2 Publish Subscribe -- "Robust".</p>
  52. </section2>
  53. <section2 topic="Positioning">
  54. <p>JRPS is required in environments where there is a higher demand for guaranteed delivery in high throughput, low latency environments where data has value and can contain business intelligence, but does not demand a full transactional (e.g. 2-phase commit) strength environment.</p>
  55. <p>Such environments often exercise business logic upon data received, so the notion of updates to all or part of data, the expression of the definitive, full compliment of a particular set of related data, the correction of data in full or in part and the notification that data is no longer valid needs to be supported. The existing type="set", though very suitable in a wide range of applications, does not provide suitable granularity in all environments.</p>
  56. <p>Robust environments require that a receiver can tell when data has been lost and that a receiver also has the means to request the repair of any gaps efficiently. This must be done whilst keeping delay or disruption to ongoing data flow to a minimum. Jabber does not provide the means to detect or repair gaps, and traditional ACKing of each packet is slow and costly.</p>
  57. <p>It would be advantageous to permit forms of permissioning and access control upon data that has value. Such permissioning and control should not be overly burdensome on the rapid transmission of data. It should allow a suitable level of abstraction to keep changes to a data item"s expression of permission coding/level to a minimum, to avoid the need for excessive changes to such codes. Abstraction will also permit permission coding to be kept compact, as it will, in effect, be tokenised.</p>
  58. <p>JRPS then requires the ability to detect and repair gaps in the stream, to provide a means to convey richer information about the nature of the data in context to what has come before and to enable the publisher to have control over who sees what.</p>
  59. <p>In addition, a pubsub component should be able to provide information and parameters about its implementation of JRPS to subscribers. Subscribers must inquire about such information from the pubsub component to gain the full benefit of a JRPS service.</p>
  60. <ol>
  61. <li>Identify the tasks that users can't complete because we are lacking this crucial piece of protocol. (Note: users are not just IM users, but any person, system, or application that could gain value from interacting with Jabber.)</li>
  62. <li>Discuss other projects or protocols and how Jabber could interface with them because of your proposed protocol enhancement (e.g., XML-RPC, SOAP, DotGNU).</li>
  63. <li>Compare Jabber to "the competition" (other IM systems or other messaging protocols) and point out holes in the Jabber protocol that need to be filled in order to offer similar functionality.</li>
  64. <li>Review the relevant history of thinking within the Jabber community.</li>
  65. </ol>
  66. <p>JRPS is a layer on Jabber Publish-Subscribe (XEP0024, XEP0036) and should interoperate with them and support namespaces and topics. Included in this document is the capability for permission tokens. It is included as the author believes that such tokens should exist within the &lt;publish&gt; tag, being a means to identify data much as the namespace or topic does.</p>
  67. <p>JRPS is different from other IM systems in that the publisher and pubsub components send out the data so that downstream entities can detect if problems occur. As a comparison, a sender in, say, MSN is told that the packet they sent cannot be delivered but in JRPS, the receiver knows that a packet or packets have not been delivered and can ask for retransmissions. The sender need not normally know about such events as the intermediate components can usually cater for it. Thus JRPS has a future in areas such as Multicasting, large distributed and proxy-based environments where the end subscribers may be very remote from the publisher.</p>
  68. <p>Existing commercial middlewares provide such facilities and it is especially necessary when data is pushed between applications and may not have an obvious "context" in the stream to data immediately before or after. Thus, JRPS may seem over-the-top for a chatroom world, but is a basic requirement for, say, distributing real-time process states, events or persistent, mutable data.</p>
  69. </section2>
  70. </section1>
  71. <section1 topic="Gap Detection And Repair">
  72. <p>This can be achieved by the use of packet sequence numbering and heartbeats whilst avoiding the necessity to positively ACK each packet.</p>
  73. <section2 topic="Sequence Numbering">
  74. <p>Multiple levels of sequence numbers are envisaged and will be used in different circumstances. Multiple levels allow a rapid repair of short "transient" breaks whilst catering for longer breaks, recoveries and resynchronisations without placing too great a burden on either subscriber or pubsub component. This discussion explains the use of a dual sequence number environment: link and source.</p>
  75. <p>Sequence numbers will be sent in each publish thus:</p>
  76. <example>
  77. &lt;iq type="set"
  78. to=""
  79. from="pubsub.localhost"&gt;
  80. &lt;query xmlns="jabber:iq:pubsub"&gt;
  81. &lt;publish ns="data topics"
  82. linkseq="57372"
  83. sourceseq="7547392"
  84. from="publisher.fromaplace"&gt;
  85. &lt;/publish&gt;
  86. &lt;publish ns="data topics"
  87. linkseq="57373"
  88. sourceseq="44211"
  89. from="publisher.elsewhere"&gt;
  90. &lt;/publish&gt;
  91. &lt;/query&gt;
  92. &lt;/iq&gt;
  93. </example>
  94. <p>The above shows sequence numbers placed in the &lt;publish/&gt; node or element. This is to abstract the publishing from any packet construction algorithms that may occur and thus allow a recovery to make use of network capacity as it sees fit and to interleave recovery and ongoing publishing data.</p>
  95. <p>The subscriber stub is responsible for ordering information and detecting and repairing any gaps to provide sequential data for consumption by the application, which should not concern itself with such issues.</p>
  96. <p>The operation of LINK and SOURCE sequence numbers are described below.</p>
  97. </section2>
  98. <section2 topic="Link Level Swquence Numbering">
  99. <p>This will concern itself with data sent on each channel. A
  100. channel can be, but is not limited to the following:</p>
  101. <ul>
  102. <li>Socket connection between Subscriber (and/or resource within same) and the Jabber pubsub component.</li>
  103. <li>Multicast datastream sent from a pubsub component but shared amongst 0..n subscribers.</li>
  104. </ul>
  105. <p>Each publish received should contain an incremental sequence number to the previous or Zero. Zero is used to reset (or resynchronise) the sequence numbering. Zero should not be used in the situation of sequence number wrapping/rollover, wherein the value1 should be used. Sequence numbering bit resolution should be ascertained by querying the pubsub component in an &lt;iq/&gt; before subscription requests are levied.</p>
  106. <p>E.g., in a 16-bit sequence number resolution channel, the sequence numbers would run as follows</p>
  107. <p>1, 2, 3, 65533, 65534, 65535, 1, 2,</p>
  108. <p>For information on sequence number bit resolution, see section 4, Source Queries.</p>
  109. </section2>
  110. <section2 topic="Source Level Sequence Numbering">
  111. <p>This will indicate the sequence number of messages sent from the publisher to the pubsub component. Should a link be lost, timeout or other such eventuality where the context of link sequence number be lost (e.g. the pubsub component decides the subscriber has disappeared and discards context), the pubsub component is still in a position to re-filter and retransmit data cached locally or even refer back to its source to maintain integrity and temporal ordering of data to the subscriber.</p>
  112. <p>To repair larger gaps, the pubsub component may provide the capability to request upwards to the source using the source sequence number, or the pubsub component may draw upon local or remote journaling services to repair the gap. The source sequence number seen by the subscriber may be the link level sequence number between publisher and pubsub component, may be the ultimate publisher sequence number or even an internal sequence number given to the incoming published data to the pubsub component on a per source basis.</p>
  113. <p>The subscriber need not know how the source sequencing operates, only notify from when the link last gave a contiguous datastream.</p>
  114. <p>One can now see that the pubsub component's conversation to the source is akin to that of a subscriber to a pubsub component.</p>
  115. </section2>
  116. <section2 topic="Gap Filling">
  117. <p>When a subscriber detects a gap on its link, it can request for the data to be resent thus:</p>
  118. <example>
  119. &lt;iq
  120. type="get"
  121. id="plugthegap1"
  122. from=""
  123. to="pubsub.localhost"&gt;
  124. &lt;query xmlns="jabber:iq:pubsub"&gt;
  125. &lt;gap linkfrom="56737" linkto="56739"&gt;
  126. &lt;/query&gt;
  127. &lt;/iq&gt;
  128. </example>
  129. <p>The values represent the missed link sequence numbers. For a gap of 1, the linkfrom and linkto are the same.</p>
  130. <p>Should the pubsub have lost the link context and thus is unable to plug the gaps it will return an error &lt;iq/&gt; packet.</p>
  131. <p>All is not lost. The subscriber has a last-ditch repair scenario by sending last-received source sequence numbers. </p>
  132. <example>
  133. &lt;iq
  134. type="get"
  135. id="plugthegap1"
  136. from=""
  137. to="pubsub.localhost"&gt;
  138. &lt;query xmlns="jabber:iq:pubsub"&gt;
  139. &lt;gap ns="publisher.fromaplace" after="56737"&gt;
  140. &lt;gap ns="publisher.elsewhere" after="211234"&gt;
  141. &lt;/query&gt;
  142. &lt;/iq&gt;
  143. </example>
  144. <p>Due to the non-contiguous nature of source sequence numbers from the subscriber point of view, the values sent must represent not the gap, but the last valid sequence number received. Each source may have a separate sequence number stream. This allows the pubsub component to manage and, if necessary, request gaps itself from the publisher to resynchronise the subscriber. The pubsub or publishing source should have the ability to refuse a rebuild/resynchronise.</p>
  145. <p>It should be possible for the subscriber to send the link and source sequence numbers in the initial request. However, if link information has been discarded by the pubsub component (e.g. the connection was dropped and presence set offline) the link sequence numbers will be reset to zero (re-synchronised) thus:</p>
  146. <example>
  147. &lt;iq
  148. type="set"
  149. to=""
  150. from="pubsub.localhost"&gt;
  151. &lt;query xmlns="jabber:iq:pubsub"&gt;
  152. &lt;publish
  153. ns="data topics"
  154. linkseq="0"
  155. sourceseq="7547392"
  156. from="publisher.fromaplace"&gt;
  157. &lt;/publish&gt;
  158. &lt;publish
  159. ns="data topics"
  160. linkseq="1"
  161. sourceseq="44211"
  162. from="publisher.elsewhere"&gt;
  163. &lt;/publish&gt;
  164. &lt;/query&gt;
  165. &lt;/iq&gt;
  166. </example>
  167. </section2>
  168. <section2 topic="Heartbeats">
  169. <p>During times of low traffic, an active circuit can be provided with regular heartbeat transmissions. Heartbeats will increment the link level sequence numbers. Subscribers missing or detecting overdue heartbeats will thus be able to detect gaps or delays even in low traffic scenarios. If the data is simply delayed, the subscriber stub is in a position to take action (and/or alert the application/user). If data is lost or heartbeats do not arrive in time, the subscriber can decide to request retransmission, disconnect or wait.</p>
  170. <example>
  171. &lt;iq
  172. type="set"
  173. to=""
  174. from="pubsub.localhost"&gt;
  175. &lt;query xmlns="jabber:iq:pubsub"&gt;
  176. &lt;publish
  177. ns="link.heartbeat"
  178. linkseq="57374"
  179. from="pubsub.localhost"&gt;
  180. &lt;/publish&gt;
  181. &lt;/query&gt;
  182. &lt;/iq&gt;
  183. </example>
  184. <p>No source sequence numbering exists here, as it is purely a link-level entity.</p>
  185. </section2>
  186. </section1>
  187. <section1 topic="Publish Types">
  188. <p>To be able to interpret published data in a more logical manner, more meaning needs to be given to data received.</p>
  189. <p>When a publish packet arrives with a topic or data namespace, there is currently no way of knowing how to interpret the tags therein. Do they replace existing tag values seen? Should previously sent tags that are not in the publish be kept or discarded? Are tag values being updated or was the previous value incorrect?</p>
  190. <p>To resolve this a type field may be added to the &lt;publish/&gt; tag.</p>
  191. <example>
  192. &lt;iq
  193. type="set"
  194. to=""
  195. from="pubsub.localhost"&gt;
  196. &lt;query xmlns="jabber:iq:pubsub"&gt;
  197. &lt;publish
  198. ns="data topics"
  199. linkseq="57372"
  200. sourceseq="7547392"
  201. from="publisher.fromaplace"
  202. type="update"&gt;
  203. &lt;/publish&gt;
  204. &lt;publish
  205. ns="data topics"
  206. linkseq="57373"
  207. sourceseq="44211"
  208. from="publisher.elsewhere"
  209. type="correction"&gt;
  210. &lt;/publish&gt;
  211. &lt;/query&gt;
  212. &lt;/iq&gt;
  213. </example>
  214. <p>This option is preferable to extending the &lt;iq/&gt; type field as there will then be no need to split &lt;iq/&gt; packets if &lt;publish/&gt; elements have different types.</p>
  215. <section2 topic="Publish Type Field Values">
  216. <p>The following extensions would be used in environments where topic/namespaces define discrete sets of data items and/or data items changing over time, as opposed to only referring to a topic datastream consisting of atomic, unrelated data. Other types can be defined as the need arises.</p>
  217. <p>'update' - partial update of data. Replaces the values of the fields of the topic/namespace it contains. Other fields held/cached downstream for this data item are still valid.</p>
  218. <p>'correction' - previous data for contained fields was incorrect - e.g. paragraph in a news story, but, as per update, unsent items are still valid.</p>
  219. <p>'image' - payload contains ALL the data for a data item/topic/namespace. All existing values should be dropped and replaced with the new data. Previously received fields not now contained within the image should be discarded. </p>
  220. <p>'drop' - namespace/topic item is now dead and all data in it should be deleted and purged from cache.</p>
  221. <p>'snapshot' - requested by subscriber and is a request for data (an image if empty of granular topics/namespaces) and no further updates, as distinct from a get, which is an on-going subscription in pubsub world.</p>
  222. <p>'add' - new topic/data item on publisher's feed. Note that an "image" publish for an item can be interpreted in the same way. Previous systems have had the ADD mechanism, but use of "add" has been discontinued, with the role taken up by the "image". (thoughts?)</p>
  223. <p>The above states (except "add") are very important for downstream caches and for applications that apply business logic to the datastreams.</p>
  224. </section2>
  225. </section1>
  226. <section1 topic="Source Queries">
  227. <p>As touched on above, subscribers should be able to enquire of the publisher regarding what capabilities it provides and what to expect. Some items of use for JRPS are as follows:</p>
  228. <ul>
  229. <li>Heartbeat. Integer milliseconds. Represents the interval between heartbeat messages. Useful for rapid detection of link level problems.</li>
  230. <li>Link Sequence Resolution. Integer. Allows subscriber to predict link sequence number rollover. Zero would indicate that it is not supported.</li>
  231. <li>Source Sequence Resolution. Integer. Allows a subscriber to predict source sequence number rollover. A zero would indicate that it is not supported.</li>
  232. <li>Gap Support. Boolean. Used to indicate if the publisher supports gap filling.</li>
  233. <li>Permissioning Scheme. There may be some standardisation of permissioning schemes so that common plugins or mechanisms can be adopted. The publisher should be able to define this.</li>
  234. <li>Rebuild On Demand. If the pubsub can support a rebuild/refresh of the current values of all subscribed-to data on demand.</li>
  235. <li>Refresh Cycle. It has been common practice to transmit a regular refresh cycle for all subscribed data. If a data item does not get an 'image' from the source for a period of time, the cache performs a logical 'drop'. Without this, intermediate caches would very soon balloon with stale data, or publishers would get every cache re-requesting or confirming if data is still alive. Zero would indicate that no refresh cycle exists for the source.</li>
  236. </ul>
  237. </section1>
  238. <section1 topic="Implementation Issues">
  239. <section2 topic="Permissioning Requirements">
  240. <p>Permissioning protocols should be open to permit a multitude of permissioning schemas. Data providers may wish to enforce their schemes in ways that suit their particular business models. The protocol should not bind or dictate such mechanisms.</p>
  241. <p>The implementation of permissioning systems and regimes over time has repeatedly shown that it is especially dangerous to assume the behaviour of data and to disregard how information is used, protected, valued and owned or to force a scheme that is rigid and assumes a narrow problem domain. Thus the scheme should permit explicit and tokenised permissioning mechanisms.</p>
  242. <p>Tokenised permissioning allows sets of data can be treated en masse. By permitting the concept of "grant" and "deny" permissions simultaneously (settings that define who CAN see something or defining who CANNOT) individual publishers can manage access both broadly and down to very fine granularity.</p>
  243. <p>Permission tokens, if used, should be sent in-band with the data. This will allow data to change its coding online and thus immediately affect permissioning without a redistribution of the permissioning information.</p>
  244. <example>
  245. &lt;iq
  246. type="set"
  247. to=""
  248. from="pubsub.localhost"&gt;
  249. &lt;query xmlns="jabber:iq:pubsub"&gt;
  250. &lt;publish
  251. ns="data topics"
  252. type="update"
  253. permtoken="6747"
  254. linkseq="57372"
  255. sourceseq="7547392"
  256. from="publisher.fromaplace"&gt;
  257. &lt;/publish&gt;
  258. &lt;/query&gt;
  259. &lt;/iq&gt;
  260. </example>
  261. <p>This does not prevent namespace/topic permissioning systems from being applied, nor should the permtoken be compulsory1.</p>
  262. <p>The pubsub systems should be able to &lt;iq/&gt; the publisher for the permissioning regime that applies.</p>
  263. <p>The definition of the XML carrying permissioning tables/information should be regime specific.</p>
  264. <p>Further information on why tokenised grant and deny permissioning is advantageous can be provided upon request.</p></section2>
  265. <section2 topic="Contributions">
  266. <p>Contributions in this context are when a subscriber publishes to one or more sources for redistribution so that it may reach the communities that subscribe to that source. By doing this, the subscriber reaches large communities, focus on specific communities and can abstract itself from delivery issues. The publisher gains information and broadens its appeal. Delivery abstraction is valuable, as a subscriber can then connect once to the publisher to gain access to all systems, networks, technologies, subscribers and media that the publisher and contributor agree upon. As you may guess, there is a need for content, flow control/throttling and ongoing permissioning to be specified and handled over time.</p>
  267. <p>Contributions requires a separate XEP, but the issues are important to the implementation of pubsub and of its permissions (Contributors have specific, complex and business-critical reasons to tightly control who sees data -- e.g. only customers, not competition!)</p>
  268. </section2>
  269. </section1>
  270. </xep>