m2http

command module
v0.0.0-...-7494f6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2016 License: AGPL-3.0 Imports: 14 Imported by: 0

README

Build Status Go Report Card

m2http

m2http is a application that forwards messages from MQTT to an HTTP endpoint using rbforwarder package.

You can modify messages before send them via HTTP on the callback:

mqttHandler := NewMQTTHandler(loadMQTTConfig(),
  func(client MQTT.Client, msg MQTT.Message) {
    opts := map[string]interface{}{
      "http_endpoint": msg.Topic(),
    }

    // Do something with the message
    data := msg.Payload()

    f.Produce(data, opts, nil)
  },
)

Installing

To install this application ensure you have the GOPATH environment variable set and glide installed.

curl https://glide.sh/get | sh

And then:

  1. Clone this repo and cd to the project

    git clone https://github.com/redBorder/m2http.git && cd m2http
    
  2. Install dependencies and compile

    make
    
  3. Install on desired directory

    prefix=/opt/rb make install
    

Usage

Usage of m2http:
  --config string
        Config file
  --debug
        Show debug info
  --version
        Print version info

To run m2http just execute the following command:

m2http --config path/to/config/file

Example config file

pipeline:
  queue: 50                       # Max internal queue size
  backoff: 15                     # Time to wait between retries in seconds
  retries: 1                      # Number of retries on fail (-1 not limited)

mqtt:
  broker: "localhost"             # MQTT brokers
  port: 1883                      # MQTT broker port
  clientid: "m2kafka"             # Client ID
  topics:                         # MQTT topics to listen
    - rb_nmsp
    - rb_radius
    - rb_flow
    - rb_loc
    - rb_monitor
    - rb_state
    - rb_social

http:
  workers: 1                      # Number of workers, one connection per worker
  url: "http://localhost:8888"    # URL of the HTTP endpoint
  insecure: false                 # Skip SSSL verification

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL