An in-memory Pub/Sub server that supports explicit acknowledgements and shared client IDs.
This server was written as a low-cost replacement to Google Pub/Sub during development and for
A screenshot of the statistics page:
You can run this server like this:
The main server listens on port 8000. It accepts requests to all endpoints.
A statistics-only server listens on port 8001. This will only respond to endpoint which provide statistics
/stats). This allows you to safely expose port 8001 as a dashboard to the public web,
while keeping port 8000 internal to your network.
Currently the Pub/Sub server supports the following environment variables, which change it's behaviour:
MAX_MESSAGE_STORAGE environment variable is set, this defines the maximum number of messages to keep in-memory
for a given client. To ensure that the server does not run out of available memory, this option defaults to 1000 messages
When the queue of unacked messages for a client exceeds
MAX_MESSAGE_STORAGE, the Pub/Sub server will start dropping the
You can set
0 to indicate that there is no maximum to the number of messages (this prevents any
messages from ever being dropped due to queue size).
To diagnose the operation of the Pub/Sub server, you can visit the
/stats URL which will show you graphs regarding the
minute-by-minute running of the server. This is useful if you need to diagnose why a client isn't receiving messages, and
can function as a dashboard to alert you of any services that are no longer processing messages.
Clients should make requests to one of the following endpoints:
- clientName: The name for the client. If multiple requests are made with the same
client name, each new message will only be dispatched to one client. This allows you to
have clients configured in a high availability configuration, and only one client will
receive the new message.
This endpoint either returns an immediate message for the client, or initiates a long poll.
- clientName: The name of the client to ack the message for.
- messageId: The message ID that was provided by
Acknowledges a message as processed for the given client. You need to call this method within 60 seconds
of the message being retrieved from
/poll, or the message will be requeued for the client (and potentially
dispatched to other long polls using the same client name).
The body of the PUT requests forms the message. The message is dispatched to all known client names (that is, you must
/poll at least once for a message to be dispatched to that client name).
curl -X PUT --data "test" http://localhost:8000/publish
Retrieves statistics about the operation of the Pub/Sub server. The format of the result of this endpoint may change
in the future. This endpoint is used by the