Initial published version.
Added more detailed error flows; added additional implementation notes.
First draft.
The Publish-Subscribe (XEP-0060)
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).
The subscriber would then send a new subscription request, this time with options.
If the subscription request can be processed successfully, the service returns an IQ-result and includes the configuration options established during the negotiation.
At any time, a publisher can push an item to the queue node.
The item is published to one of the subscribers.
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.
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.
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.
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.
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.
The service then MUST unlock the item and notify only this subscriber that the item has been unlocked.
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.
If the entity that attempts to unlock the item is not the subscriber that received the item, the service MUST return a <forbidden/> error.
If the item is locked by another subscriber, the service MUST return a <conflict/> error.
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.
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 (XEP-0030)
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)
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
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
urn:xmpp:pubsub:queueing:0
The node or service supports the queueing mode.
XEP-xxxx
]]>