Learn background processing with sidekiq
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
client
server
.gitignore
.ruby-version
Gemfile
Gemfile.lock
README.md
exercise_verification.rb

README.md

HTTP Requests and Sidekiq

Created by @sjreich

Many companies use a microservices architecture, in which many small parts of their system communicate with one another via HTTP requests. Typically, we use Sidekiq or similar libraries like Delayed Job and Resque, to make those requests asynchronously and to handle retrying requests if something goes wrong.

This exercise introduces the relevant concepts via Sidekiq.

Setup

The setup for this exercise is a bit complicated. Sorry.

  1. Bring in this repo, and its dependencies.
$ git clone <copy the address from github>
$ cd sidekiq-and-http-exercise
$ bundle install
  1. You'll need a Redis server running locally. In a new terminal window, run:
  $ brew install redis
  $ redis-server
  1. Start the web server you'll be interacting with. In a new terminal window, run:
  $ ruby server/server.rb
  1. Start the sidekiq background process(es). In a new terminal window, run:
  $ bundle exec sidekiq -r ./client/sidekiq_workers.rb

The Exercises

The main file to work on is 'client/main.rb'. Read it, edit it, execute it.

  $ ruby client/main.rb

You'll also need to edit 'client/sidekiq_workers.rb'. For your changes there to take effect, you will need to kill off the existing sidekiq process(es) with ctrl-C, and then restart them using the command above.

When you're done, kill off everything with ctrl-C.

Resources