Git Product home page Git Product logo

simple-message-helper's Introduction

Message Helper

This simplifies interactions for working with a message broker when you really don't need a full feature set - basically just send and receive. It's written in CoffeeScript and is used downstream to run chatops tasks as part of a Hubot deployment.

Basic usage

var readyFn = function() {
    console.log("Connected and configured");

    communicator.send("Do stuff");
};

var messageHandler = function(message) {
    console.log("Got a message:", message);
};

var disconnected = function() {
    console.log("Disconnected");
}

var messageHelper = require('message-helper')
var communicator = new messageHelper(readyFn, messageHandler, disconnected);

From the above, you'd expect the message "Do stuff" to get published to your exchange.

Configuration

You can use the default configuration:

configuration =
    user: "guest"
    password: "guest"
    host: "localhost"
    port: 5672
    vhost: "/"
    commandExchangeName: "hubot-commands"
    commandRoutingKey: "hubot-commands"
    responseExchangeName: "hubot-responses"
    responseQueueName: "hubot-responses"

Or, use custom environment variables:

export AMQP_USER="amqp_user"
export AMQP_PASSWORD="amqp_password"
export AMQP_HOST="amqp_host"
export AMQP_PORT="amqp_port"
export AMQP_VHOST="amqp_vhost"
export AMQP_COMMAND_EXCHANGE_NAME="amqp_command_exchange_name"
export AMQP_COMMAND_ROUTING_KEY="amqp_command_routing_key"
export AMQP_RESPONSE_EXCHANGE_NAME="amqp_response_exchange_name"
export AMQP_RESPONSE_QUEUE_NAME="amqp_response_queue_name"

simple-message-helper's People

Contributors

combatpoodle avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.