Jetty has moved!
Jetty is a project at the Eclipse Foundation.
Homepage:http://www.eclipse.org/jetty
Downloads: http://download.eclipse.org/jetty/
Documentation:http://www.eclipse.org/jetty/documentation/current/
About:http://www.eclipse.org/jetty/about.php
Jetty Powered:http://www.eclipse.org/jetty/powered/
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Acknowledged Messages

The acknowledged messages extension provides reliable ordered messaging to the Bayeux protocol in cometd-jetty server and for the cometd-dojox and cometd-jquery clients.

Messages sent to each client are kept in an unacknowleged queue and only deleted when an acknowledgement is received. Unacknowledged messages are resent.

Client-server Negotiation

In order to enable message acknowledgement, both client and server must indicate that they support message acknowledgement. This is negotiated during handshake. On handshake, the client sends {"ext":{"ack": "true"}} to indicate that it supports message acknowledgement. If the server also supports message acknowledgment, it likewise replies with {"ext":{"ack": "true"}}.

Enabling server-side for cometd-jetty

To enable support for acknowledged messages, the extension must be added to the bayeux instance during or after initialization:
Add the AcknowledgedMessagesExtension to your list of Bayeux extensions.

AcknowledgedMessagesExtension

The AcknowledgedMessageExtension is a per server extension that monitors handshakes from new client, looking for clients that also support the acknowledged message extension and then adds the AcknowledgedMessagesClientExtension to each client on handshake.

AcknowledgedMessagesClientExtension

Once added to a client, the AcknowledgedMessagesClientExtension prevents messages being delivered on any request other than a /meta/connect so to prevent the possibility of out of order delivery. The extension also maintains a list of unacked messages and intercepts the /meta/connect traffic to insert and check ack IDs.

Enabling client-side for cometd-dojo

The clients side for dojo is provided by dojox/cometd/ack.js which was released in dojo 1.3.0b2 (but can also be applied to dojo 1.2.x). To enable client side the dojo requires mechanism is used:

This is sufficient to enable the extension, however it may then be programmatically disable/enabled before initialization by setting the ackEnabled boolean field:

Enabling client-side for cometd-jquery

The client side for jquery is enabled by including the jquery.cometd-ack.js file (bundled with jetty 6.1.15).

Details

Demo

There is an example of acknowledged messages in the dojox chat demo that comes bundled with cometd.

To run the demo, download the Jetty implementation of cometd, then:

Point your browser to http://localhost:8080/examples/chat/ and make sure to check "Enable reliable messaging?".

This will give you one extra option, "Acknowledge incoming messages", after you have joined. If checked, it will automatically acknowledge all incoming messages. If unchecked, it will not acknowledge incoming messages, which will make the server re-send these messages on next /meta/connect.

  • No labels
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery