stomptherabbit
stomptherabbit
is a program that allows to broadcast STOMP over Websocket
messages to an AMQP broker.
Architecture overview
The only Stomp broker tested is ActiveMQ.
The only AMQP broker tested is RabbitMQ.
Prerequisites
You need to install Go
Installation
Global installation with go
The following command installs the binary stomptherabbit
in $GOPATH/bin
go install github.com/CanalTP/stomptherabbit/cmd/stomptherabbit
From source
git clone https://github.com/CanalTP/stomptherabbit
make build
Configuration
stomptherabbit
needs some connection configuration for the websocket and
Rabbitmq.
You can load the configuration from environment variables.
Global installation only supports environment files.
Configuration parameters
Environment variable |
Default |
Signification |
APP_WEBSTOMP_TARGET |
|
Url for STOMP connection |
APP_WEBSTOMP_LOGIN |
|
Login |
APP_WEBSTOMP_PASSCODE |
|
Password |
APP_WEBSTOMP_DESTINATION |
|
Topic or queue |
APP_WEBSTOMP_PROTOCOL |
|
STOMP version |
APP_WEBSTOMP_SENDTIMEOUT |
0 |
Send timeout for STOMP heartbeat |
APP_WEBSTOMP_RECVTIMEOUT |
0 |
Receive timeout for STOMP heartbeat |
APP_AMQP_URL |
|
AMQP broker URL |
APP_AMQP_EXCHANGE_NAME |
|
AMQP exchange name |
APP_AMQP_CONTENT_TYPE |
application/json |
Content type of the message published |
APP_NEWRELIC_APP_NAME |
|
App name in NewRelic |
APP_NEWRELIC_LICENSE_KEY |
|
NewRelic License Key |
APP_NEWRELIC_ENABLED |
false |
Enable/disable NewRelic |
APP_NEWRELIC_PLATFORM |
|
DEV, INT, CUS, PROD |
APP_NEWRELIC_FEED_TYPE |
|
schedule or circumstantial |
Example
# .env
APP_WEBSTOMP_TARGET=wss://your_broker_url
APP_WEBSTOMP_LOGIN=your_login
APP_WEBSTOMP_PASSCODE=your_passcode
APP_WEBSTOMP_DESTINATION=/topic/your_topic
APP_WEBSTOMP_PROTOCOL=v12.stomp
APP_WEBSTOMP_SENDTIMEOUT=1000
APP_WEBSTOMP_RECVTIMEOUT=1000
APP_AMQP_URL=amqp://guest:guest@localhost:5672//
APP_AMQP_EXCHANGE_NAME=your_exchange
APP_AMQP_CONTENTTYPE=application/json
APP_LOGGER_JSON=true
APP_NEWRELIC_APP_NAME=my-app
APP_NEWRELIC_LICENSE_KEY=my_license_key
APP_NEWRELIC_ENABLED=true
APP_NEWRELIC_PLATFORM=DEV
Usage
From global installation
Make sure $GOPATH/bin
is in your PATH
export $(cat .env| xargs)
stomptherabbit
From source
export $(cat .env| xargs)
make run
With Docker
docker build -t stomptherabbit .
docker run --rm --env-file=.env.yml stomptherabbit