One part of the rewrite of all of my sites is to make dynamic content more real-time, specifically using Websockets, so that content is as close as live as it’s possible. For this I’m using the current RabbitMQ release running within a docker container with the web_stomp plugin enabled. With this I can then have a webpage connect over websockets directly into the message broker and listen for messages.
Now the problem. Most events are defined as some change within a database so I now need a method to allow a database trigger to be able to send a message to RabbitMQ without hindering performance – more so when some tables are being updated 20-40 times a second.
Fortunately PostgreSQL provides us with asynchronous notifications via the LISTEN and NOTIFY commands, so we can add a notify command to the trigger to a named queue and then have a separate process listen to that queue. All I needed to implement was an application that did the listening. Continue reading “Publishing messages to RabbitMQ from PostgreSQL”
It’s been a busy 6 months, trying to update all of my websites whilst commuting etc & it’s taking a long time especially as the front end’s are being done from scratch. If someone ever tells you it’s simple to move from a classic website to one using microservices, don’t believe them – it will take some time.
Anyhow, progress is progress. Here’s the current status:
- The blog is now on it’s own domain, new layout, still not happy about how it looks though.
- Documentation and API’s are now on the area51.onl site with more being added as I finish them.
- departureboards.mobi is almost complete, just got some minor layout issues to solve.
- uktra.in is next. Most of the backend stuff is done, just got to port the CMS over and rewrite the timetable search & real time search pages.
- map.lu is running to the point it’s now providing maps again to the other sites.
- maidstoneweather.com & the weather station are still sadly down. I’ve got the replacement electronics ready but again it’s finding time to fix it – it’s only taken a year so far :-S
- trainwatch.uk is still dormant – not found a use for that domain yet.
So there’s still plenty to do. When you spend 20+ hours just commuting on top of the working week it’s a problem, but I’m getting there.