Search code examples
rubyherokumessage-queuesidekiq

Shared message queues between apps with Heroku


I have two web applications, both to be hosted on Heroku. One is the front-end app, in the sense that all consumer facing actions will be through this app. New sign-ups, etc. The other is the back-end, this ones deals with all of the processing of new customers, their orders, and associated business-logic. I need these apps to talk to each-other and pass data between them. I'd rather not write an api on the BE app, as only the FE app would be consuming it, and this would mean I'd need to spend time writing security rules and restrictions to prevent others from accessing it.

My question is whether I can use a shared messaging queue between them instead, and whether this was a good idea, and something that's possible on Heroku? Does an add-on/service exist for this use-case? Most of the queuing add-ons listed have the workers and task creators in the same app.

I've been looking at Sidekiq as a possibility, as the BE app will need a queue for other tasks anyway, and this seems like a good candidate, but I'm not sure that even if I provide a shared Redis instance between the apps, Sidekiq has the capability to pass messages between them. Anyone know?


Solution

  • I've been having a lot of success using AMQP on Heroku. There's a heroku plugin available (CloudAMQP) and good ruby support for AMQP.

    In terms of provisioning services like this on Heroku in general, I've been provisioning the plugin in the main Heroku application, and sharing the environment config with other applications.