Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.
/ message-router Public archive

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

License

Notifications You must be signed in to change notification settings

strider2038/message-router

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages