Skip to content

alexpapworth/sidekiq-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Sidekiq Two-Way Communcation Demo

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.

Setup

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

Run the Sidekiq workers

Do this in two different terminal windows.

sidekiq -r ./analysis-app.rb

and

sidekiq -r ./export-app.rb

Run the scripts, and send commands between them

Analysis App

irb -r ./analysis-app.rb

Then try:

RunExport.perform_in(0, [1,2,3]) 

Export App

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!

A screenshot of your hopeful Sidekiq output

About

🤝 Two-Way Communication with Sidekiq

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages