Abstract: | This specification defines an extension to XMPP publish-subscribe for queueing information at a node. |
Authors: | Joe Hildebrand, Peter Saint-Andre |
Copyright: | © 1999 - 2009 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Deferred |
Type: | Standards Track |
Version: | 0.1 |
Last Updated: | 2008-11-13 |
WARNING: Consideration of this document has been Deferred by the XMPP Standards Foundation. Implementation of the protocol described herein is not recommended.
1. Introduction
2. How It Works
2.1. Subscribing
2.2. Assigning an Item
2.3. Deleting an Item from the Queue
2.4. Unlocking an Item
3. Determining Support
4. Implementation Notes
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
7.1. Protocol Namespaces
7.2. Protocol Versioning
7.3. Service Discovery Features
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
The Publish-Subscribe [1] extension to XMPP provides a comprehensive technology for alerts, notifications, data syndication, rich presence, and other real-time messaging use cases. In terms of traditional publish-subscribe systems like Java Message Service (JMS), the core XMPP PubSub specification covers the Observer design pattern only; however, traditional publish-subscribe systems often include support for a second design pattern, usually called the "point-to-point" or "queueing" pattern. [2] This specification defines a few small extensions to XMPP PubSub that enable support for a queueing mode in XMPP. The queueing mode is an add-on feature that a service can support, and that a node owner can enable if supported by the service. The feature name is "urn:xmpp:pubsub:queueing:0".
If a node has enabled support for the queueing mode, in response to a subscription request without configuration options it MUST return an IQ-error containing a subscription options form; this form MUST include the "queue_requests" field (which specifies the number of parallel requests a subscriber is willing to process).
<iq from='workflows.shakespeare.lit' id='sub1' to='workerbee237@shakespeare.lit/foo' type='error'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe jid='workerbee237@shakespeare.lit' node='a290fjsl29j19kjb'/> <options jid='workerbee237@shakespeare.lit' node='a290fjsl29j19kjb'> <x xmlns='jabber:x:data' type='form'> <field var='FORM_TYPE' type='hidden'> <value>http://jabber.org/protocol/pubsub#subscribe_options</value> </field> <field type='text-single' var='pubsub#queue_requests'> <required/> </field> </x> </options> </pubsub> <error type='modify'> <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> <configuration-required xmlns='http://jabber.org/protocol/pubsub#errors'/> </error> </iq>
The subscriber would then send a new subscription request, this time with options.
<iq from='workerbee237@shakespeare.lit/foo' id='sub2' to='workflows.shakespeare.lit' type='set'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe jid='workerbee237@shakespeare.lit' node='a290fjsl29j19kjb'/> <options jid='workerbee237@shakespeare.lit' node='a290fjsl29j19kjb'> <x xmlns='jabber:x:data' type='submit'> <field var='FORM_TYPE' type='hidden'> <value>http://jabber.org/protocol/pubsub#subscribe_options</value> </field> <field var='pubsub#queue_requests'> <value>5</value> </field> </x> </options> </pubsub> </iq>
If the subscription request can be processed successfully, the service returns an IQ-result and includes the configuration options established during the negotiation.
<iq from='workflows.shakespeare.lit' id='sub2' to='workerbee237@shakespeare.lit/foo' type='result'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscription jid='workerbee237@shakespeare.lit' node='a290fjsl29j19kjb' subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3' subscription='subscribed'/> <options> <x xmlns='jabber:x:data' type='result'> <field var='FORM_TYPE' type='hidden'> <value>http://jabber.org/protocol/pubsub#subscribe_options</value> </field> <field var='pubsub#queue_requests'> <value>5</value> </field> </x> </options> </pubsub> </iq>
At any time, a publisher can push an item to the queue node.
<iq from='engine.shakespeare.lit' id='pub1' to='workflow.shakespeare.lit' type='set'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'> <example xmlns='urn:xmpp:example'>payload</example> </item> </publish> </pubsub> </iq>
The item is published to one of the subscribers.
<message from='workflow.shakespeare.lit' id='foo' to='workerbee237@shakespeare.lit'> <event xmlns='http://jabber.org/protocol/pubsub#event'> <items node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'> <example xmlns='urn:xmpp:example'>payload</example> </item> </items> </event> </message>
When the subscriber that received the item has successfully processed it (whatever that means in the context of the queue), the subscriber deletes the item from the queue.
<iq from='workerbee237@shakespeare.lit/foo' id='delete1' to='workflows.shakespeare.lit' type='get'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <retract node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </retract> </pubsub> </iq>
In the context of a queue node, the service MUST treat a delete request from a subscriber that received the item as if the sender were a publisher; i.e., it MUST delete the item from the queue and notify only this subscriber that the item has been deleted.
<message from='workflow.shakespeare.lit' id='bar' to='workerbee237@shakespeare.lit'> <event xmlns='http://jabber.org/protocol/pubsub#event'> <items node='a290fjsl29j19kjb'> <retract id='ae890ac52d0df67ed7cfdf51b644e901'/> </items> </event> </message>
Note: The subscriber SHOULD NOT commit any pending transactions until it receives the delete notification.
If the item does not exist, the service MUST return an <item-not-found/> error as described in XEP-0060.
If the entity that attempts to delete the item is not the subscriber that received the item, the service MUST return a <forbidden/> error as described in XEP-0060.
If the item is locked by another subscriber, the service MUST return a <conflict/> error (this flow is not defined in XEP-0060.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='get'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <retract node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </retract> </pubsub> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
If the subscriber that received the item attempts to delete the item but the item is no longer locked by the subscriber (e.g., because of a race condition or a lost notification), the service MUST return an <unexpected-request/> error (this flow is not defined in XEP-0060.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='get'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <retract node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </retract> </pubsub> <error type='wait'> <unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
The subscriber might determine that it cannot process the item (whatever that means in the context of the queue); if so, the subscriber unlocks the item.
<iq from='workerbee237@shakespeare.lit/foo' id='unlock1' to='workflows.shakespeare.lit' type='get'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unlock xmlns='urn:xmpp:pubsub:queueing:0' node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </unlock> </pubsub> </iq>
The service then MUST unlock the item and notify only this subscriber that the item has been unlocked.
<message from='workflow.shakespeare.lit' id='baz' to='workerbee237@shakespeare.lit'> <event xmlns='http://jabber.org/protocol/pubsub#event'> <items node='a290fjsl29j19kjb'> <unlock xmlns='urn:xmpp:queueing:0' id='ae890ac52d0df67ed7cfdf51b644e901'/> </items> </event> </message>
When an item is unlocked, the service would then send a publish notification to another subscriber according to application-specific logic for determining the "next" subscriber.
If the item does not exist, the service MUST return an <item-not-found/> error.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='error'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unlock xmlns='urn:xmpp:pubsub:queueing:0' node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </unlock> </pubsub> <error type='cancel'> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
If the entity that attempts to unlock the item is not the subscriber that received the item, the service MUST return a <forbidden/> error.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='error'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unlock xmlns='urn:xmpp:pubsub:queueing:0' node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </unlock> </pubsub> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
If the item is locked by another subscriber, the service MUST return a <conflict/> error.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='error'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unlock xmlns='urn:xmpp:pubsub:queueing:0' node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </unlock> </pubsub> <error type='cancel'> <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
If the subscriber that received the item attempts to unlock the item but the item is no longer locked by the subscriber (e.g., because of a race condition or a lost notification), the service MUST return an <unexpected-request/> error.
<iq from='workflows.shakespeare.lit' id='delete1' to='workerbee237@shakespeare.lit/foo' type='error'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <unlock xmlns='urn:xmpp:pubsub:queueing:0' node='a290fjsl29j19kjb'> <item id='ae890ac52d0df67ed7cfdf51b644e901'/> </unlock> </pubsub> <error type='wait'> <unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
If a pubsub service supports the queueing mode, it MUST advertise support for the "urn:xmpp:pubsub:queueing:0" namespace in response to Service Discovery [3] information requests.
If the service receives unavailable presence from a subscriber, it SHOULD unlock all outstanding queue items associated with the subscriber and unsubscribe the subscriber to prevent delivery of further publish notifications.
If a subscriber cannot process queue items because of an unrecoverable error (e.g., disk full), the subscriber SHOULD unsubscribe and then unlock all of its outstanding queue items.
If the service does not receive a delete or unlock request from a subscriber that received a queue item in a configurable amount of time, it SHOULD timeout the request, send an unlock notification to the subscriber, and send a publish notification to the "next" subscriber.
To follow.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].
This specification defines the following XML namespace:
Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar [5] shall add the foregoing namespaces to the registry located at <http://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function [6].
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.
The XMPP Registrar [7] maintains a registry of service discovery features (see <http://xmpp.org/registrar/disco-features.html>), which includes a number of features that can be returned by pubsub services. The following registry submission supplements the existing list.
<var> <name>urn:xmpp:pubsub:queueing:0</name> <desc>The node or service supports the queueing mode.</desc> <doc>XEP-xxxx</doc> </var>
Series: XEP
Number: 0254
Publisher: XMPP Standards Foundation
Status:
Deferred
Type:
Standards Track
Version: 0.1
Last Updated: 2008-11-13
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0060
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
Source Control:
HTML
RSS
Email:
jhildebr@cisco.com
JabberID:
hildjj@jabber.org
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0060: Publish-Subscribe <http://xmpp.org/extensions/xep-0060.html>.
2. See for instance <http://en.wikipedia.org/wiki/Java_Message_Service>.
3. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.
4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
5. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
6. XEP-0053: XMPP Registrar Function <http://xmpp.org/extensions/xep-0053.html>.
7. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
Initial published version.
(psa)Added more detailed error flows; added additional implementation notes.
(jjh/psa)First draft.
(psa/jjh)END