In this post I want to cover installing and publishing events to the excellent RouteMaster event bus.
Routemaster is an opinionated event bus over HTTP, supporting event-driven / representational state notification architectures.
RouteMaster uses RabbitMQ under the hood.
First of all install and start RouteMaster:
1 2 3 4 5 6 7
Install and start RabbitMQ:
1 2 3
rabbitmq-server is not found make sure
/usr/local/sbin is in your
Create a Virtual Host
- Visit http://localhost:15672/#/
- Login with guest/guest (the default user for RabbitMQ)
- Go to Admin => Virtual hosts => add a new virtual host called
- The virtual host can be changed in
Add a user to the Virtual Host
admin user with full permissions to the newly created virtual host.
Setup port and SSL proxy
Since Routemaster only excepts SSL connections we need to jump through a few hoops.
We want this proxying:
15672 is the default port which RouteMaster binds to and can be changed in
- Forward port 443 (HTTPS) to 80 (HTTP)
1 2 3
1 2 3 4 5 6
Publish an Event
Now the fun starts…
irb session we are going to try and connect to RouteMaster:
1 2 3
demo is already known to RouteMaster see
If you get a
Timeout error most likely the port proxying is not setup correctly. Ensure
pow is running.
cannot connect to bus error is most likely an authentication issue between RouteMaster and RabbitMQ.
Check the output of
foreman to confirm, you might see something like
If so make sure the virtual host is setup and the
guest user is assigned with full permissions:
1 2 3 4
Sending a create event
RouteMaster only supports a small set of event types:
If the client connected try publishing an event:
The first argument is the topic, which is automatically created if it does not exist. There should be one topic per domain concept. The URL is where the subscribers can fetch a representation of the created entity.
You should see output in foreman since RouteMaster logs to STDOUT by default, e.g.
POST /topics/widgets HTTP/1.1" 200.