{"id":14955833,"url":"https://github.com/jbgo/chasqui","last_synced_at":"2025-10-06T09:30:19.348Z","repository":{"id":59152017,"uuid":"40162082","full_name":"jbgo/chasqui","owner":"jbgo","description":"Chasqui adds persistent publish-subscribe (pub-sub) messaging capabilities to Sidekiq and Resque workers.","archived":false,"fork":false,"pushed_at":"2015-12-26T17:25:38.000Z","size":199,"stargazers_count":17,"open_issues_count":10,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-10T11:23:54.572Z","etag":null,"topics":["broker","pub-sub","publish-subscribe","pubsub","redis","redis-database","resque-workers","ruby","ruby-gem","ruby-library","ruby-on-rails","rubygem","rubygems","rubyonrails","sidekiq","workers"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbgo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-04T03:47:06.000Z","updated_at":"2022-07-28T23:10:22.000Z","dependencies_parsed_at":"2022-09-13T10:50:24.196Z","dependency_job_id":null,"html_url":"https://github.com/jbgo/chasqui","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jbgo/chasqui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbgo%2Fchasqui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbgo%2Fchasqui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbgo%2Fchasqui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbgo%2Fchasqui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbgo","download_url":"https://codeload.github.com/jbgo/chasqui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbgo%2Fchasqui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278585890,"owners_count":26011070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["broker","pub-sub","publish-subscribe","pubsub","redis","redis-database","resque-workers","ruby","ruby-gem","ruby-library","ruby-on-rails","rubygem","rubygems","rubyonrails","sidekiq","workers"],"created_at":"2024-09-24T13:11:52.650Z","updated_at":"2025-10-06T09:30:19.069Z","avatar_url":"https://github.com/jbgo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jbgo/chasqui.svg?branch=master)](https://travis-ci.org/jbgo/chasqui)\n[![Code Climate](https://codeclimate.com/github/jbgo/chasqui/badges/gpa.svg)](https://codeclimate.com/github/jbgo/chasqui)\n\n# Chasqui\n\nChasqui adds persistent\n[publish-subscribe](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern)\n(pub-sub) messaging capabilities to Sidekiq and Resque workers.\n\n## Installation\n\nAdd this line to your application's Gemfile\n\n    gem 'chasqui'\n\nthen execute\n\n    $ bundle\n\nor install it yourself as\n\n    $ gem install chasqui\n\n## Dependencies\n\nChasqui uses [Redis](http://redis.io/) to store events and manage\nsubscriptions. You can install Redis with your favorite package manager, such\nas homebrew, yum, or apt, or if you prefer, you can run `vagrant up` to run\nRedis in a virtual machine. If you already have Resque or Sidekiq working, then\nyou already have everything you need to get started with Chasqui.\n\n## Quick Start\n\n### Start the broker\n\n    chasqui -r redis://localhost:6379/0\n\nThe broker is a ruby daemon that listens for events (messages) published to\nchannels (topics) and forwards those events to registered subscribers.  In\norder to work, your broker must use the same Redis database as your\nSidekiq/Resque workers. For a list of available broker options, see `chasqui\n--help`.\n\n### Publish events\n\n    Chasqui.publish 'order.purchased', user, order\n\nPublish an event to the `order.purchased` channel and include information\nabout the user and order that triggered the event. Any arguments after the\nchannel name must be JSON-serializable.\n\n### Define workers to handle events\n\nWith Sidekiq\n\n    class OrderPublishWorker\n      include Sidekiq::Worker\n      sidekiq_options queue: 'pubsub' # you can use any options sidekiq supports\n\n      def perform(event, user, order_details)\n        # custom logic to handle the event\n      end\n    end\n\nWith Resque\n\n    class OrderPublishWorker\n      @queue = 'pubsub' # choice of queue name is up to you\n\n      def self.perform(event, user, order_details)\n        # custom logic to handle the event\n      end\n    end\n\nThe `OrderPublishWorker` is a normal Sidekiq (or Resque) worker. The first\nargument to the perform method is a [Chasqui::Event](#) object, and the\nremaining arguments are the same arguments you passed to `Chasqui.publish`.\n\n### Subscribe to events\n\n    Chasqui.subscribe do\n      on 'order.purchased', PurchasedOrderWorker\n      # ...more subscriptions\n    end\n\nThe above code tells Chasqui to place events published to the `order.purchased`\nchannel on `PurchaseOrderWorker`'s queue.\n\nYou can also use a callable object instead of a worker class to handle events.\n\n    Chasqui.subscribe queue: 'app_id:pubsub' do\n      on 'order.purchased', -\u003e(event, user, order) {\n        logger.info event.to_json\n      }\n    end\n\n### Running Subscribers\n\nWith Sidekiq\n\n    bundle exec sidekiq -q app_id:pubsub\n\nWith Resque\n\n    QUEUES=app_id:pubsub bundle exec rake resque:work\n\nSubscribers are normal Sidekiq or Resque workers, and can take advantage of all\navailable features and plugins.  Please refer to the documentation for those\nlibraries for detailed instructions.\n\n* [Sidekiq documentation](https://github.com/mperham/sidekiq)\n* [Resque documentation](https://github.com/resque/resque)\n\n### Configuration\n\n    Chasqui.configure do |c|\n      c.redis = 'redis://my-redis.example.com:6379'\n      ...\n    end\n\nFor a full list of configuration options, see the\n[Chasqui::Config documentation](http://www.rubydoc.info/gems/chasqui/Chasqui/Config).\n\n## Unsubscribing\n\n    Chasqui.unsubscribe 'order.purchased', 'app_id:pubsub'\n\nIf you no longer wish to handle events for a channel, you should unsubscribe\nthe worker so that the Chasqui broker stops placing jobs on that worker's\nqueue.\n\n## Why Chasqui?\n\n* Persistent - events don't get lost when the broker restarts or your workers\n  are not running.\n* Integrates with the proven Sidekiq and Resque background worker libraries.\n* Reduces service coupling - publishers have no knowledge of subscribers and\n  subscribers have no knowledge of publishers.\n\n## Limitations\n\nChasqui requires that the publisher, broker, and all subscribers must connect\nto the same Redis database. If your applications use separate Redis databases,\nthey will not be able to communicate with each other using Chasqui.\n\n## Contributing\n\n* For feature requests, please [open an issue](https://github.com/jbgo/chasqui/issues/new)\n  to discuss the proposed feature.\n* For bug fixes, you are welcome to create a pull request without first opening\n  an issue.\n* Except for documentation changes, tests are required with all pull requests.\n* Please be polite and respectful when discussing the project with maintainers\n  and your fellow contributors.\n\n## Code of Conduct\n\nIf you are unsure whether or not your communication is appropriate for Chasqui\nplease consult the [Chasqui Code of Conduct](code-of-conduct.md).  If you\nsuspect harassment or abuse, please report it to the email address listed in\nthe Code of Conduct.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbgo%2Fchasqui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbgo%2Fchasqui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbgo%2Fchasqui/lists"}