A small sidekiq demo created for OpenCorporates to test communication between two internal apps.
Note that we can use one Redis URL/queue, but send multiple classes on it. Both apps have both these classes, but only one of them has the perform
method for each class. It is through this facility that we "place" messages on the queue, and have them removed and performed by the other app.
Install the Sidekiq gem.
gem install sidekiq
Make sure you have Redis running, either locally, or on some virtual platform like Docker.
brew install redis
Do this in two different terminal windows.
sidekiq -r ./analysis-app.rb
and
sidekiq -r ./export-app.rb
irb -r ./analysis-app.rb
Then try:
RunExport.perform_in(0, [1,2,3])
irb -r ./export-app.rb
Then try:
UpdateAnalysisApp.perform_in(0, 1)
You should see a message appear of the opposite app's sidekiq queue!