Skip to content

deepstreamIO/deepstream.io-msg-amqp

Repository files navigation

deepstream.io-msg-amqp Build npm version

A deepstream.io message connector for amqp This connector uses the npm amqp package. Please have a look there for detailed options.

What is AMQP?

The "Advanced Message Queueing Protocol" is implemented by a large number of brokers, e.g. RabbitMQ, Qpid, HornetQ or ActiveMQ to name just a few. AMQP supports powerful routing patterns and achieves high reliability through features such as persistent queues or guaranteed message delivery.

Why use AMQP with deepstream?

AMQP is reliable and widely adopted. It also comes fully managed as part of cloud hosting offerings like Azure's Service Bus.

When not to use AMQP with deepstream?

deepstream doesn't actually use the advanced messaging and routing patterns that AMQP offers. Instead, it sets up a single topic-exchange for name based routing and binds a queue per topic and client to it to create a publish/subscribe workflow.

Equally, deepstream doesn't necessarily require the advanced persistence and guaranteed message delivery features that AMQP offers - data is stored within the storage layer and messaging is only used to propagate updates - meaning that subsequent messages will reconcile a corrupted state.

How to use AMQP with deepstream?

deepstream offers an official plugin to connect to AMQP-clusters. It can be installed via deepstream's Command Line Interface using the msg keyword, e.g.

deepstream install msg amqp

If you're using deepstream in Node, you can also install it via NPM

How to configure the amqp connector?

You can configure the amqp connector in the plugins section of deepstream's config.yml file (by default either in the conf directory or in /etc/deepstream on Linux)

##Basic Setup

plugins:
  message:
    name: amqp
    options:
      host: ${AMQP_HOST}
      port: ${AMQP_PORT}
var Deepstream = require( 'deepstream.io' ),
    AMQPConnector = require( 'deepstream.io-msg-amqp' ),
    server = new Deepstream();

server.set( 'messageConnector', new AMQPConnector( {
  port: 5672,
  host: 'localhost'
}));

server.start();