Skip to content

RabbitMQ Consumer

The RabbitMQ is listening on a Queue destination to a RabbitMQ messaging server.

Getting Started

You will need RabbitMQ installed on your machine. You can find all relevant information in the official documentation below:

Basic Usage

Start listening on a queue

import { consumer } from "sdk/rabbitmq";
consumer.startListening("rabbitmq-queue", "<rabbitmq-project>/<rabbitmq-handler>");

File: <rabbitmq-project>/<rabbitmq-handler>

exports.onMessage = function(message) {
    console.log("Hello from My RabbitMQ Listener! Message: " + message);

exports.onError = function(error) {
    console.error("Error from My RabbitMQ Listener! Error: " + error);

Stop listening on a queue

import { consumer } from "sdk/rabbitmq";
consumer.stopListening("rabbitmq-queue", "<rabbitmq-project>/<rabbitmq-handler>");


Function Description Returns
startListening(queue, handler) Start listening on a given queue and destination -
stopListening(queue, handler) Stops listening for new messages -