Like a telephone children's game, this tool connects different application protocols (HTTP request, HTTP/2 protocol buffer) and open source messaging systems (NATS MQTT) and allows transfert data between them. From HTTP request to the MQTT message pubblication, passing through HTTP/2 and NATS. It's also possible to run Client/Server system standalone to test and evaluate the communications individually. Fully developed in GO.
make generate/go
start/all
to launch docker NATS & MQTT, HTTP Server, gRPC Server, NATS and MQTT Subscriptionrequest/curl
to launch the HTTP request
go run main.go httpserver
to launch HTTPServer in listening mode, on port setted inconfig.yml
. Default value is3300
. The server receive the request with paramshttp://localhost:3300/init?topic=<preferred_topic>&payload=<preferred_payload>
, create the protocl buffer and foreward it to the gRPC Server.
go run main.go grpcserver
to launch gRPCServer in listening mode, on port setted inconfig.yml
. Default value is7777
.
go run main.go grpcclient
to interact with gRPCServer, sending protobuffermodels.PingMessage
. The protocol bufer containstopic
andpayload
that will be needed for the Nats messaging system.
-
first of all
docker-compose up
to launch the Nats service on port 4222 -
go run main.go natssubscriber --topic=<preferred_topic>
to subscribe to the topic preferred. Be careful that the--topic
match with the topic selected at the http request time, otherwise you won't see the message coming. If no topic is provided it reads the value from the config.yml.
go run main.go natspublisher --topic=<preferred_topic> --payload=<preferred_payload>
useful to test nats messaging system standalone. After launching Nats service and nats subscriber, launch the publisher to interact with the message broker.
-
first of all
docker-compose up
to launch the MQTT service on port 1883 -
go run main.go mqttsubscriber --topic=<preferred_topic>
to subscribe to the topic preferred. Be careful that the--topic
match with the topic selected at the http request time, otherwise you won't see the message coming. If no topic is provided it reads the value from the config.yml.#
for multiple subscriptions
go run main.go mqttpublisher --topic=<preferred_topic> --payload=<preferred_payload>
useful to test mqtt messaging system standalone. After launching MQTT service andmqttsubscriber
, launch the publisher to interact with the message broker.