No commit activity in last 3 years
No release in over 3 years
It adopts mixin method to make service object with circuit breaker pattern. And it has tasks to facilitates service object creation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.0
~> 10.0
~> 3.0

Runtime

 Project Readme

MakeServiceable

This gem will help you implement circuit breaker pattern to all services objects. Any unstable API should be protected by circuit breaker pattern. When API call fails so frequently, circuit will be opened and will skip the method directly to fail fast and get more resilient behaviour. After few seconds it will close circuit so method get called normaly.

Installation

Add this line to your application's Gemfile:

gem 'make_serviceable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install make_serviceable

Usage

Following command will create new service object under app/services folder.

$ bundle exec make_serviceable generate TestService

This is how service object looks like.

class TestService
  include MakeServiceable

  # Pass ncessary parameters and then use it in #call
  def initialize()
  end

  # Set service name (optional). Default is class name
  # def service_name
  # end

  # Chage circuit behaviour here. Read documentation of circuitbox
  # def circuit_option
  # {}
  # end

  def call
    # Call any API call here. All failures are captured by circuit and it will be protected by circuit breaker pattern.
  end
end

And you can call

TestService.call()

Development

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/make_serviceable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MakeServiceable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.