%ents; ]>
Atomically Compare-And-Publish PubSub Items This specification provides a mechanism to atomically Compare-And-Publish items to a PubSub node. &LEGALNOTICE; xxxx ProtoXEP Standards Track Standards Council XEP-0030 XEP-0060 cap &flow; 0.0.1 2017-04-20 fs

First draft.

This specification provides a mechanism to atomically publish items to a PubSub node depending on the item ID of the node's latest item. This allows to prevent race conditions and avoids data loss in certain situations.

If an entity supports the Compared-And-Publish feature it MUST advertise the fact by returning a <feature/> with the 'var' attribute set to 'urn:xmpp:pubsub:cap:0' in response to a &xep0030; query for information.

In order to atomically compare-and-publish an item, a client sends an &IQ; with a 'pubsub' element qualified by the 'urn:xmpp:pubsub:cap:0' namespace. The element MUST contain the same attributes and elements as the <publish/> element defined in &xep0060; and it MUST contain a previd attribute containing an item ID.

The PubSub service MUST only publish the item if the node's latest item ID is equal to the ID found in the 'previd' attribute.

Soliloquy To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? tag:denmark.lit,2003:entry-32397 2003-12-13T18:30:02Z 2003-12-13T18:30:02Z ]]>

If the 'previd' matched the latest item's ID and if the service was able to successfully process the request then the protocol continues as defined in XEP-0060 7.1.2.

In case the Compare-And-Publish operation failed because the latest node id is not the same as given in the 'previd' attribute in the request, the server returns an &IQ; result with 'pubsub' element qualified by the 'urn:xmpp:pubsub:cap:0' namespace which contains a <compare-and-publish-failed/> element. The element MUST have a 'id' attribute with the ID of the lastest item.

]]>

All other error cases are handled as specified in XEP-0060 § 7.1.3

This extension protocol does not add any further security considerations to the ones mentioned in XEP-0060 § 14..

This document requires no interaction with the Internet Assigned Numbers Authority (IANA).

This specification defines the following XML namespaces:

urn:xmpp:pubsub:cap:0 Indicates support for Compare-And-Publish XEP-XXXX ]]>

TODO: Add after the XEP leaves the 'experimental' state.