{"id":28063516,"url":"https://github.com/ruby-amqp/kicks","last_synced_at":"2025-05-12T12:11:48.439Z","repository":{"id":246271806,"uuid":"820596243","full_name":"ruby-amqp/kicks","owner":"ruby-amqp","description":"The project originally known as Sneakers","archived":false,"fork":false,"pushed_at":"2025-05-07T21:34:25.000Z","size":609,"stargazers_count":74,"open_issues_count":1,"forks_count":13,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-07T22:30:33.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ruby-amqp.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-26T19:43:51.000Z","updated_at":"2025-05-07T21:34:30.000Z","dependencies_parsed_at":"2024-09-06T23:49:10.808Z","dependency_job_id":"f03404b2-3031-49f4-bb2b-ceed9f902bd0","html_url":"https://github.com/ruby-amqp/kicks","commit_stats":null,"previous_names":["ruby-amqp/kicks"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-amqp%2Fkicks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-amqp%2Fkicks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-amqp%2Fkicks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-amqp%2Fkicks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby-amqp","download_url":"https://codeload.github.com/ruby-amqp/kicks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253736096,"owners_count":21955783,"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","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":[],"created_at":"2025-05-12T12:11:47.801Z","updated_at":"2025-05-12T12:11:48.419Z","avatar_url":"https://github.com/ruby-amqp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kicks, né Sneakers\n\n[![CI](https://github.com/ruby-amqp/kicks/actions/workflows/ci.yml/badge.svg)](https://github.com/ruby-amqp/kicks/actions/workflows/ci.yml)\n\n```\n      __\n  ,--'  \u003e\n  `=====\n\n```\n\n## What is Kicks?\n\nKicks is a high-performance RabbitMQ background processing framework for\nRuby, originally developed by @jondot 👏 under the name of [Sneakers](https://github.com/jondot/sneakers).\nThe original repo was abandoned by the person who has exclusive control\nover the RubyGems project, so the community of users has decided to move it\nto this \"fork\" (continuation) under the new name.\n\nBy virtue of its Sneakers lineage, Kicks is a mature project that has been around since 2016.\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'kicks'\n```\n\nAnd then execute:\n\n```shell-session\nbundle\n```\n\nOr install it yourself as:\n\n```shell-session\ngem install kicks\n```\n\n## Documentation\n\nA quick start guide is available in the section below.\n\nVisit the [wiki](https://github.com/jondot/sneakers/wiki) for more detailed\ndocumentation and [GitHub releases](https://github.com/jondot/sneakers/releases) for release\nnotes.\n\nA [change log](./ChangeLog.md) is also available.\n\n## Quick start\n\nSet up a Gemfile\n\n```ruby\nsource 'https://rubygems.org'\ngem 'kicks'\ngem 'json'\ngem 'redis'\n```\n\nHow do we add a worker? Firstly create a file and name it as `boot.rb`\nthen create a worker named as `Processor`.\n\n\u003e touch boot.rb\n\n```ruby\n# Note: the files still use \"sneakers\" for the name\nrequire 'sneakers'\nrequire 'redis'\nrequire 'json'\n\n$redis = Redis.new\n\nclass Processor\n  include Sneakers::Worker\n  from_queue :logs\n\n  def work(msg)\n    err = JSON.parse(msg)\n    if err[\"type\"] == \"error\"\n      $redis.incr \"processor:#{err[\"error\"]}\"\n    end\n\n    ack!\n  end\nend\n```\n\nLet's test it out quickly from the command line:\n\n```shell-session\n$ sneakers work Processor --require boot.rb\n```\n\nWe just told Sneakers to spawn a worker named `Processor`, but first `--require` a file that we dedicate to setting up environment, including workers and what-not.\n\nIf you go to your RabbitMQ admin now, you'll see a new queue named `logs` was created. Push a couple messages like below:\n\n```javascript\n{\n   \"type\": \"error\",\n   \"message\": \"HALP!\",\n   \"error\": \"CODE001\"\n}\n```\n\nPublish a message with the [bunny](https://github.com/ruby-amqp/bunny) gem RabbitMQ client:\n\n```ruby\nrequire 'bunny'\n\nconn = Bunny.new\nconn.start\n\nch = conn.create_channel\nch.default_exchange.publish({ type: 'error', message: 'HALP!', error: 'CODE001' }.to_json, routing_key: 'logs')\n\nconn.close\n```\n\nAnd this is the output you should see at your terminal.\n\n```\n2013-10-11T19:26:36Z p-4718 t-ovqgyb31o DEBUG: [worker-logs:1:213mmy][#\u003cThread:0x007fae6b05cc58\u003e][logs][{:prefetch=\u003e10, :durable=\u003etrue, :ack=\u003etrue, :heartbeat_interval=\u003e2, :exchange=\u003e\"sneakers\"}] Working off: log log\n2013-10-11T19:26:36Z p-4718 t-ovqgyrxu4 INFO: log log\n2013-10-11T19:26:40Z p-4719 t-ovqgyb364 DEBUG: [worker-logs:1:h23iit][#\u003cThread:0x007fae6b05cd98\u003e][logs][{:prefetch=\u003e10, :durable=\u003etrue, :ack=\u003etrue, :heartbeat_interval=\u003e2, :exchange=\u003e\"sneakers\"}] Working off: log log\n2013-10-11T19:26:40Z p-4719 t-ovqgyrx8g INFO: log log\n```\n\nWe'll count errors and error types with Redis.\n\n``` shell-session\n$ redis-cli monitor\n1381520329.888581 [0 127.0.0.1:49182] \"incr\" \"processor:CODE001\"\n```\n\nWe're basically done with the ceremonies and all is left is to do some real work.\n\n### Looking at metrics\n\nLet's use the `logging_metrics` provider just for the sake of fun of seeing the metrics as they happen.\n\n```ruby\n# boot.rb\nrequire 'sneakers'\nrequire 'redis'\nrequire 'json'\nrequire 'sneakers/metrics/logging_metrics'\nSneakers.configure(metrics: Sneakers::Metrics::LoggingMetrics.new)\n\n# ... rest of code\n```\n\nNow push a message again and you'll see:\n\n```\n2013-10-11T19:44:37Z p-9219 t-oxh8owywg INFO: INC: work.Processor.started\n2013-10-11T19:44:37Z p-9219 t-oxh8owywg INFO: TIME: work.Processor.time 0.00242\n2013-10-11T19:44:37Z p-9219 t-oxh8owywg INFO: INC: work.Processor.handled.ack\n```\n\nWhich increments `started` and `handled.ack`, and times the work unit.\n\nFrom here, you can continue over to the\n[Wiki](https://github.com/jondot/sneakers/wiki)\n\n# Docker\n\nIf you use Docker, there's some benefits to be had and you can use both\n`docker` and `docker-compose` with this project, in order to run tests,\nintegration tests or a sample worker without setting up RabbitMQ or the\nenvironment needed locally on your development box.\n\n* To build a container run `docker build . -t sneakers_sneakers`\n* To run non-integration tests within a docker container, run `docker run --rm\n  sneakers_sneakers:latest`\n* To run full integration tests within a docker topology including RabbitMQ,\n  Redis (for integration worker) run `scripts/local_integration`, which will\n  use docker-compose to orchestrate the topology and the sneakers Docker image\n  to run the tests\n* To run a sample worker within Docker, try the `TitleScraper` example by\n  running `script/local_worker`. This will use docker-compose as well. It will\n  also help you get a feeling for how to run Sneakers in a Docker based\n  production environment\n* Use `Dockerfile.slim` instead of `Dockerfile` for production docker builds.\n  It generates a more compact image, while the \"regular\" `Dockerfile` generates\n  a fatter image - yet faster to iterate when developing\n\n# Compatibility\n\n* Kicks main branch: Ruby 3.0+\n* Kicks 3.1.x branch: Ruby 3.0+\n* Kicks 3.0.x: Ruby 2.5+\n* Sneakers 2.7.x and later (using Bunny 2.9): Ruby 2.2.x\n* Sneakers 1.1.x and later (using Bunny 2.x): Ruby 2.x\n* Sneakers 1.x.x and earlier: Ruby 1.9.x, 2.x\n\n# Contributing\n\nFork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).\n\n### Thanks:\n\nTo all Sneakers [Contributors](https://github.com/jondot/sneakers/graphs/contributors) - you make this happen, thanks!\n\n## License\n\nSee [LICENSE](LICENSE.txt) for further details.\n\n## Copyright\n\nCopyright (c) 2023-2024 Kicks contributors.\n\nCopyright (c) 2015-2023 [Dotan Nahum](http://gplus.to/dotan) [@jondot](http://twitter.com/jondot).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-amqp%2Fkicks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby-amqp%2Fkicks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-amqp%2Fkicks/lists"}