User Tools

Site Tools


sib:callers:rabbitcaller

RabbitCaller

Overview

The RabbitCaller SIB Caller puts messages on RabbitMQ queues.

Details

Modulesib_rabbitcaller
Version1.3.5

Workflow

  • Caller triggered by mqtt message
    • format input
    • get RabbitMQ connection
    • send message to queues configured in custom file

Custom configuration

rabbitlistener/custom.js
var custom = {
    _id: "rabbitSample:1",
    _name: "SIB RabbitMQ Caller Sample",
    getQ: (topic, msg, callback )=>{callback(this.custom.q);},
    loggerCfg: {
        dest: {
            file: false,
            console: true,
            mqtt: true
        }
    },
    inputFormat: (topic, msg, cb)=>{
        cb(msg);
    },
    rabbitmq: "amqp://localhost",
    q: [
        {path: "path/to/queue", durable: true, archive: "path/to/queue/archive"}
    ],
    mqtt: "mqtt://localhost",
    topic: "SIB/Samples/RabbitCaller"
};
 
module.exports = custom;
  • _id: The unique ID of this service
  • _name: A plaintext description of this service
  • getQ: Is run before publishing messages onto MQ, the callback is sent a q array as described below and determins which queues to publish messages to. The queues returned by this method must be set in the default.q array OR be created manually in RabbitMQ for this to work
  • inputFormat(topic, msg, cb): The method that is run on service activation. The original message is passed as the argument and the return value from this method must be a JSON formatted message conforming to the SIB message standard.
  • rabbitmq: The RabbitMQ connection string
  • q: Definitions of the queues that should be consumed by the listener. Each queue definition should contain:
    • path: The name of the queue
    • archive: The name of the archive queue. Default is path + “/archive”
    • durable: Set to true if the queue should be durable. If false the queue will be removed when the RabbitMQ is restarted. Default is true.
  • loggerCfg: A JSON Object defining what logger actions should be active for this service (see Logger Configuration
  • mqtt: The MQTT connection string for the internal MQTT transport
  • topic: The MQTT topic to subscribe to on the internal MQTT transport
sib/callers/rabbitcaller.txt · Last modified: 2019/05/13 11:40 by hubbe