Hi All,
May be of general interest to the group generally and happy to share the code as another 'bridge' example (with apologies in advance for my coding style!)
I've been recently working on my own message bridge between STOMP and RabbitMQ but written in Flutter/Dart. Why Flutter? My logic here is it allows you to build to a native desktop app that will run on Windows, Linux and MacOS - so in theory multiplatform with native performance. Also runs on Web clients and iOS/Android but who wants a bridge server running on their mobile 😆👀.
Design
I've written my own STOMP connector class and the solution uses MQTT to connect Flutter to RabbitMQ as that library is more mature than AMQP in the Dart ecosystem. Its intended to run as single publisher, single consumer - a pipe basically.
The Rabbit queue is set up as 'classic' and durable. RabbitMQ and MQTT Plugin configurations are all 'out of the box', the only change being that Rabbit has been opened up from 127.0.0.1 to allow connections from my development Mac and that I've added a queue bound to the default exchange for MQTT which is 'amq.topic'. A routing key is used to direct traffic to the queue (and this is the 'topic' given to MQTT in Flutter).
I plan that a RabbitMQ consumer will eventually persist the messages to a MySQL db to sit with the snapshot, timetable and ref data I've already collected via Apache/PHP/MySQL.
Progress
I have the server running on MacOS successfully consuming /topic/darwin.pushport-v16 and delivering to a RabbitMQ queue hosted on a 2nd MacOS machine. With some caveats however!
Caveats
- Doesn't process ERROR frames at the moment
- Doesn't handle heartbeats
- UI controls (buttons) rather than full automation at this point
- While I'm getting a high data rate and I've got no gaps in message numbers when consuming from the STOMP side, I'm getting around 10-15% of messages being dropped on the RabbitMQ side ☹️ I've not yet pinned down the MQTT library or the Rabbit configuration.
It'd be really appreciated if anyone has similar experience with dropouts on RabbitMQ could assist and if there are any common settings/gotchas with RabbitMQ that I should look out for...
Many thanks in advance!
Mark