message-router

command module
v0.0.0-...-04c5f57 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MIT Imports: 2 Imported by: 0

README

Message router

Build Status Go Report Card codecov

Microservice for dispatching messages received by HTTP (JSON RPC v2) to Apache Kafka.

How to use

Docker

Pull and run docker image. Don't forget to set Apache Kafka brokers host by MESSAGE_ROUTER_KAFKA_BROKERS environment variable.

docker pull strider2038/message-router
docker run --name message-router -d -p 3000:3000 -e "MESSAGE_ROUTER_KAFKA_BROKERS: http://kafka.com:9092" strider2038/message-router

Now you can send messages that will be dispatched to Apache Kafka.

POST http://localhost:3000/rpc
Content-Type: application/json

[
    {
        "jsonrpc": "2.0",
        "method": "dispatch",
        "params": {
            "topic": "firstTopic",
            "message": {
                "value": {
                    "property": "value",
                    "object": {
                        "a": 1
                    }
                }
            }
        },
        "id": 1
    },
    {
        "jsonrpc": "2.0",
        "method": "dispatch",
        "params": {
            "topic": "secondTopic",
            "message": {
                "value": {
                    "body": "Message body"
                }
            }
        },
        "id": 2
    }
]
From binaries

Build and run go application. Again, don't forget to set Apache Kafka brokers host by MESSAGE_ROUTER_KAFKA_BROKERS environment variable.

dep ensure
go build
./message-router

Future tasks

  • Acceptance testing
  • Stats method
  • Concurrency support

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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