Need help with expeditor?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

210 Stars 14 Forks MIT License 265 Commits 1 Opened issues


Expeditor provides asynchronous execution and fault tolerance for Microservices

Services available


Need anything else?

Contributors list


Gem Version Build Status

Expeditor is a Ruby library that provides asynchronous execution and fault tolerance for microservices.

It is inspired by Netflix/Hystrix.


Expeditor currently supports Ruby 2.1 and higher.

Add this line to your application's Gemfile:

gem 'expeditor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install expeditor


asynchronous execution

command1 = do

command2 = do ... end

command1.start # non blocking command2.start # non blocking

command1.get # wait until command1 execution is finished and get the result command2.get # wait until command2 execution is finished and get the result

asynchronous execution with dependencies

command1 = do

command2 = do ... end

command3 = [command1, command2]) do |val1, val2| ... end

command3.start # command1 and command2 are started concurrently, execution of command3 is wait until command1 and command2 are finished.


command = do
  # something that may be failed

use fallback value if command is failed

command_with_fallback = command.set_fallback do |e| log(e) default_value end

command.start.get #=> error may be raised command_with_fallback.start.get #=> default_value if command is failed

If you set

, fallbacks do not occur. It is useful in test codes.


command = 1) do

command.start command.get #=> Timeout::Error is raised if execution is timed out


command = do

the option is completely same as retryable gem

command.start_with_retry( tries: 3, sleep: 1, on: [StandardError], )

using thread pool

Expeditor use concurrent-ruby's executors as thread pool.

require 'concurrent'

service = executor: min_threads: 0, max_threads: 5, max_queue: 100, ) )

command = service) do ... end


=> #<:status:0x007fdeeeb18468>

service.reset_status! # reset status in the service </:status:0x007fdeeeb18468>

circuit breaker

The circuit breaker needs a service metrics (success, failure, timeout, ...) to decide open the circuit or not. Expeditor's circuit breaker has a few configuration for how it collects service metrics and how it opens the circuit.

For service metrics, Expeditor collects them with the given time window. The metrics is gradually collected by breaking given time window into some peice of short time windows and resetting previous metrics when passing each short time window.

service =
  threshold: 0.5,      # If the failure rate is more than or equal to threshold, the circuit will be opened.
  sleep: 1,            # If once the circuit is opened, the circuit is still open until sleep time seconds is passed even though failure rate is less than threshold.
  non_break_count: 20, # If the total count of metrics is not more than non_break_count, the circuit is not opened even though failure rate is more than threshold.
  period: 10,          # Time window of collecting metrics (in seconds).

command = service) do ... end

is used to ignore requests to the service which is not frequentlly requested. Configure this value considering your estimated "requests per period to the service". For example, when
period = 10
non_break_count = 20
and the requests do not occur more than 20 per 10 seconds, the circuit never opens because Expeditor ignores that "small number of requests". If you don't ignore the failures in that case, set
to smaller value than

The default values are:

  • threshold: 0.5
  • sleep: 1
  • nonbreakcount: 20
  • period: 10

synchronous execution


option of
, command executes synchronous on current thread.
command1 = do

command2 = do ... end

command1.start(current_thread: true) # blocking command2.start(current_thread: true) # blocking

command1.get command2.get


After checking out the repo, run

to install dependencies. Then, run
for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run

bundle exec rake install
. To release a new version, update the version number in
, and then run
bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the
file to


  1. Fork it ( )
  2. Create your feature branch (
    git checkout -b my-new-feature
  3. Commit your changes (
    git commit -am 'Add some feature'
  4. Push to the branch (
    git push origin my-new-feature
  5. Create a new Pull Request

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.