A message broker implementing the STOMP protocol written in Go.
I have written a simple chat client designed to use a generic STOMP pub-sub server called stomp-chat that can serve as an example of a client for this server.
Currently one simple point-to-point messaging example is included at examples/PointToPoint
. Clone the repo, navigate to that folder, and run docker-compose up
to see it in action.
- Pull Docker image from the GHCR:
$ docker pull ghcr.io/tydar/stomper:main
- Run and publish the port from the example config:
$ docker run -d -p 32801:32801 ghcr.io/tydar/stomper:main
- Connect with a STOMP client at port 32801 and test!
To overwrite Stomper's default settings, you can pass environment variables to the container:
$ docker run -d -p 32801:32801 --env STOMPER_TOPICS="/queue/env1 /queue/env2" ghcr.io/tydar/stomper:main
This project contains a minimal default.nix
. To build the Stomper using Nix, you should follow these steps:
- On NixOS, ensure you are working with Go installed:
nix-shell -p go
. - Run
go mod vendor
in the project directory. - Run
nix build
.
Parameter | ENV variable | Default Value | Description |
---|---|---|---|
Port | STOMPER_PORT | 32801 | TCP port server listens on |
Hostname | STOMPER_HOSTNAME | localhost | hostname on which server accepts connections |
TCPDeadline | STOMPER_TCPDEADLINE | 0 | TCP timeout (time in seconds allowed between msg from client, 0 means no timeout) |
LogPath | STOMPER_LOGPATH | ./stomper.log | path to log file |
LogToFile | STOMPER_LOGTOFILE | true | should we stomper log to a file? |
LogToStdout | STOMPER_LOGTOSTDOUT | false | should stomper log to stdout? |
Topics | STOMPER_TOPICS | ["/queue/main"] | list of pub-sub topics |
SendWorkers | STOMPER_SENDWORKERS | 1 | Number of send worker goroutines to spawn |
MetricsServer | STOMPER_METRICSSERVER | false | should we expose a JSON metrics endpoint? |
MetricsAddress | STOMPER_METRICSADDRESS | ":8080" | address string for Metrics Service ListenAndServe call |
An example config file is provided: stomper_config.yaml
. Stomper will look for a file with this name in either /etc/stomper
or the directory from which it is called.
- Creating a topic with a message
- If a SUBSCRIBE frame includes a header with key
create
and valuetrue
, it will create the topic if it does not already exist.
- If a SUBSCRIBE frame includes a header with key
- Frame parsing
- Define interface for queueing
- Implement memory queue backend
- Frame handling
- CONNECT
- SUBSCRIBE
- UNSUBSCRIBE
- SEND
- MESSAGE
- RECEIPT
- ERROR
- DISCONNECT
- BEGIN
- COMMIT
- ABORt
- Semantics
- Supports only pub-sub currently
- runtime topic creation by clients
- Configuration of worker pool for message forwarding
- Server connection protocol
- Size limits?
- Rate limits?
- Auth?
- crypto/tls
- RBAC?
- Define semantics beyond STOMP protocol
- Implement frame actions
- ACK
- NACK
- Message queueing (depends on ACK, NACK)