< Table of Contents

Checklist: How to Build JavaScript AMQP Clients

This checklist provides the steps necessary to build JavaScript AMQP clients to communicate with the Kaazing WebSocket Gateway:

# Step Topic or Reference
1 Learn about supported browsers, operating systems, and platform versions. Release Notes
2 Learn about the Kaazing Gateway AMQP client. Overview of the Kaazing Gateway JavaScript AMQP Client Library
3 Learn how to use the Gateway AMQP Client Library and the supported APIs. Use the Kaazing Gateway JavaScript AMQP Client Library
4 Learn how to authenticate your client by implementing a challenge handler to respond to authentication challenges from the Gateway. Secure Your JavaScript AMQP Client

Overview of AMQP 0-9-1

Advanced Message Queuing Protocol (AMQP) is an open standard for messaging middleware that was originally designed by the financial services industry to provide an interoperable protocol for managing the flow of enterprise messages. To guarantee messaging interoperability, AMQP 0-9-1 defines both a wire-level protocol and a model—the AMQP Model—of messaging capabilities.

The AMQP Model defines three main components:

  1. Exchange: clients publish messages to an exchange
  2. Queue: clients read messages from a queue
  3. Binding: a mapping from an exchange to a queue

An AMQP client connects to an AMQP broker and opens a channel. Once the channel is established, the client can send messages to an exchange and receive messages from a queue.

For more information about AMQP, visit http://www.amqp.org.

WebSocket and AMQP

WebSocket enables direct communication from the browser to an AMQP broker. The Gateway radically simplifies Web application design by providing the AMQP client libraries for Java, .NET, and JavaScript client technologies. Web developers can code directly against the back-end AMQP broker without the need for custom Servlets or server-side programming.

Using the AMQP client libraries, you can take advantage of the AMQP features, making the browser a first-class citizen in AMQP systems (similar to C, Java, Python, and other clients). This means that you can now run AMQP clients directly in a browser.

Overview of the Kaazing Gateway JavaScript AMQP Client Library

Kaazing WebSocket Gateway includes AMQP client libraries that allow clients to subscribe and publish messages to a message broker using AMQP. With the Kaazing WebSocket Gateway AMQP client libraries, you can leverage WebSocket in your application by building a JavaScript client. This WebSocket client then enables communication between your application and the message broker, as shown in the following figure:

Kaazing Gateway JavaScript AMQP Client
Figure: Kaazing Gateway JavaScript AMQP Client Connection

Starting an AMQP Broker

There are a wide variety of AMQP brokers available that implement different AMQP versions. For example, RabbitMQ, Apache Qpid, OpenAMQ, Red Hat Enterprise MRG, ØMQ, and Zyre. If you do not have an AMQP broker installed yet, you can use the Apache Qpid AMQP broker included in the Gateway download package, that supports AMQP version 0-9-1.

To set up and start the Apache Qpid broker on your system, perform the steps described in Setting Up the Gateway and Clients.

Note: The AMQP client libraries are compatible with AMQP version 0-9-1. Refer your AMQP broker documentation for information about certified AMQP versions.

For information on integrating with RabbitMQ, see Integrate RabbitMQ Messaging.

Taking a Look at the AMQP Demo

Once the AMQP broker is set up, take a look at a demonstration that was built with the JavaScript version of the AMQP client library. To see this demo in action, perform the following steps:

  1. Start the Kaazing Gateway and Apache Qpid as described in Setting Up the Gateway and Clients.
  2. Download or clone the Kaazing JavaScript Tutorials from Github at https://github.com/kaazing/javascript.client.tutorials.
  3. Follow the steps on the Github repo README to build the AMQP tutorial, and serve it using Node.js®.
  4. In a browser, navigate to http://localhost:3000/ and use the demo. The demo connects to a publicly available instance of Kaazing WebSocket Gateway and an AMQP broker at ws://sandbox.kaazing.net/amqp091.