%ents; ]>
Customizable Message Routing This specification specifies customizable behavior of RFC 6121 section 8.5.2.1.1 to allow various message routing algorithms (e.g., for load balancing). &LEGALNOTICE; 0354 Deferred Standards Track Standards Council XMPP Core XMPP IM XEP-0030 NOT_YET_ASSIGNED &flow; 0.2 2017-09-11 XEP Editor (jwi) Defer due to lack of activity. 0.1 2014-10-15 XEP Editor (aw)

Initial published version approved by the XMPP Council.

0.0.1 2014-09-22 fs

First draft.

The "Server Rules for Processing XML Stanzas" section in &rfc6121; defines only a "one receives" or "all receive" algorithm for message routing if the receiving entity of a message stanza has multiple connected resources and the message is addressed to a bare JID. Also RFC 6121 does not define a method to check or change the currently used message routing algorithm. Furthermore, none of the described routing algorithms is a good match when it comes down to achieve load-balancing between the connected resources, which is sometimes desirable.

This extensions solves those issues by allowing clients to configure their desired message routing algorithm. By exploiting the freedom provided by RFC 6121 which allows servers to implement their own algorithm for determining the "most available" resource.

&xep0254; defines a XEP to queue PubSub items, which could be used as alternative approach, instead of the herein defined message routing algorithms ('urn:xmpp:cmr:roundrobin' and 'urn:xmpp:cmr:weighted'). But this solution requires more and complexer code on the server and client side, while the guarantees provided by XEP-0254 are not always required.

The authors have designed the customizable message routing protocol with the following requirements in mind:

The following terms are used throughout this document

Customizable Message Routing (CMR)
The name of this XEP and the protocol defined by it.
Message Routing Algorithm
An algorithm that defines how a server processes message stanzas send to a server-local bare JID of type 'message' or 'chat', with at least one available or connected resource of the receiver (RFC 6121 § 8.5.2.1.1).

Non-balancing message algorithms consists of the traditional algorithms that are widely used by XMPP implementations as defined in RFC 6121 § 8.5.2.1.1 and &rfc3921;. They usually try to send a message either to the all resources or try to determine the best resource based on some heuristic. They where designed with human-to-human interaction in mind.

Examples for non-balancing algorithms include:

  • Deliver to all ('urn:xmpp:cmr:all')

  • Deliver to most active resource ('urn:xmpp:cmr:mostactive')

Balanced message routing algorithms try to distribute messages between the available resources of the receiver. They are ideal for use with the Internet of Things (IoT) and especially machine to machine (M2M) technologies.

Consider a large deployment of sensor nodes send their data to a cluster for further processing. Every cluster node establishes a connection using the same bare JID but a different resource for receiving the sensor data. Furthermore, after a cluster connection is authenticated, it queries the XMPP service for the CMR status, and enables a balancing message routing algorithm.

The sensor nodes can now send their data as payload of a message stanza to the cluster. The server will evenly distributed the data between the cluster nodes by using a round-robin scheme.

Since CMR balances message stanzas of type 'normal' or 'chat', PubSub notifications will also be evenly distributed between the connected resources of an connection where CMR is active.

Examples for balancing algorithms include:

  • Load balance using round robin ('urn:xmpp:cmr:roundrobin')

  • Weighted load balancing ('urn:xmpp:cmr:weighted')

CMR is not suitable for scenarios where the routing behavior should also consider resources with negative priority. This would violate RFC 6121 § 8.5.2.1.1. A suitable specification for such use cases may already exists. For example a proper solution that involves forking of messages even to resources with negatives priorities is explained in Section 6 of &xep0280;.

An entity advertises support for this protocol by including the 'urn:xmpp:cmr:0' feature in its service discovery information features as specified in &xep0030; or section 6.3 of &xep0115;.

]]> ... ... ]]>

Clients are able to query the server for the currently active and available message routing algorithms.

]]>

The result IQ, must include exactly one <active/> element and at least one <available/> element. Both elements must posses a 'algorithm' attribute, which contains the name of the available or active algorithm.

]]>

To change the active message routing algorithm, the client sends an &IQ; of type 'set' containing a 'cmr' child element which contains the desired algorithm as value of the 'algorithm' attribute.

]]>

The server will respond with an result &IQ; if the routing algorithm was successfully changed.

]]>

If the server is unable to change the message routing algorithm, then an error &IQ; is returned to the client.

]]>

If allowed and supported by the server, clients are able to annotate message stanza with a routing hint, that SHOULD affect the used message routing algorithm for the annotated stanza.

]]> ... ... ]]> ]]> ]]> Hello everyone ]]>

Clients are allowed to change the CMR state at any time. CMR MUST only affect the routing of message stanzas of type 'normal' or 'chat', which are addressed to a bare JID and where the receiving entity has more then one available resource with a non-negative presence priority. That is, it affects the routing decision as described in RFC 6121 § 8.5.2.1.1 for messages of type 'normal' and 'chat'.

The CMR state, ie. the used routing algorithm, is identical for every session of an XMPP client. Therefore implementations MUST NOT allow different CMR states between the resources of the same bare JID.

If an entity advertises support for CMR as described in 3. it MUST support at least one message routing algorithm.

Algorithm Namespace: 'urn:xmpp:cmr:all'

Deliver to all non-negative resources with share the same maximum priority. And if message type is 'chat', only to those that have opted in to receive chat messages.

Algorithm Namespace: 'urn:xmpp:cmr:mostactive'

Deliver the message to the "most available" resource or resources, depending on the server's implementation.

Algorithm Namespace: 'urn:xmpp:cmr:roundrobin'

Deliver the message to the next resource selected by a round-robin algorithm.

Algorithm Namespace: 'urn:xmpp:cmr:weighted'

Deliver the message to a resource selected by a weighted round-robin algorithm. The weight of a resource is determined by its priority.

Servers implementing CMR MUST at least implement one message routing algorithm, and offer at least one of of 'urn:xmpp:cmr:all' and 'urn:xmpp:cmr:mostactive'. Technically this is a constraint derived from Section 8.5.2.1.1. of RFC 6121.

This specification introduces no known security considerations.

This document requires no interaction with &IANA;.

This specification defines the following XML namespace:

  • urn:xmpp:cmr:0

Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.

&NSVER;
The protocol documented by this schema is defined in XEP-XXXX: http://www.xmpp.org/extensions/xep-xxxx.html ]]>