{"id":16389373,"url":"https://github.com/marcelog/ebunny_pool","last_synced_at":"2026-06-07T23:30:14.384Z","repository":{"id":18017490,"uuid":"21044703","full_name":"marcelog/ebunny_pool","owner":"marcelog","description":"A rabbitmq worker pool","archived":false,"fork":false,"pushed_at":"2015-02-20T14:54:30.000Z","size":312,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T10:28:50.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcelog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-20T16:31:01.000Z","updated_at":"2017-09-21T07:24:59.000Z","dependencies_parsed_at":"2022-08-26T09:41:35.548Z","dependency_job_id":null,"html_url":"https://github.com/marcelog/ebunny_pool","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2Febunny_pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2Febunny_pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2Febunny_pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2Febunny_pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelog","download_url":"https://codeload.github.com/marcelog/ebunny_pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240199180,"owners_count":19763820,"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":"2024-10-11T04:32:41.960Z","updated_at":"2026-06-07T23:30:14.255Z","avatar_url":"https://github.com/marcelog.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ebunny_pool\nThis is a simple library that allows you to implement [rabbitmq](http://www.rabbitmq.com/)\nworkers. It will automatically declare the exchange and queue needed, and create\n a [DLX](https://www.rabbitmq.com/dlx.html) for it too, so failed tasks can be\n retried after the specified interval.\n\nThis is similar to [rabbitmq_minionpool](https://github.com/marcelog/rabbitmq_minionpool).\n\n# How to use\nStart the top level supervisor named **ebunny_pool_sup** from your own\nsupervisor tree. Create a module that implements the behavior **ebunny_pool_worker**:\n\n```erlang\n-module(sample_worker).\n\n-behavior(ebunny_pool_worker).\n\n-export([init/1, handle/3, terminate/2]).\n\n-include_lib(\"amqp_client/include/amqp_client.hrl\").\n\n-record(state, {}).\n\ninit(Options) -\u003e\n  {ok, #state{}}. % You can return {ok, term()} | {error, term()}.\n\nhandle(\n  DeliverInfo = #'basic.deliver'{\n    consumer_tag = _ConsumerTag,\n    delivery_tag = DeliveryTag,\n    redelivered = _Redelivered,\n    exchange = _Exchange,\n    routing_key = _RoutingKey\n  },\n  Message = #amqp_msg{\n    props = _Props,\n    payload = Payload\n  },\n  State\n) -\u003e\n  lager:debug(\"Got message: ~p\", [Payload]),\n  ok. % Return ok to ACK the message, or error to reject it and send it to the DLX.\n\nterminate(_Reason, _State) -\u003e\n  ok.\n```\n\nTo start a new consumer:\n```erlang\nebunny_pool:new_consumer([\n  {user, \"guest\"},\n  {pass, \"guest\"},\n  {vhost, \"/\"},\n  {port, 5672},\n  {host, \"127.0.0.1\"},\n  {reconnect_timeout, 5000}, % If rabbitmq connection dies, try to reconnect every N milliseconds\n  {exchange, \"workers\"}, % Name of the excuange. DLX Exchange will be the same ++ \".retry\"\n  {queue, \"download\"}, % Name of the queue. DLX Queue will be the same ++ \".retry\"\n  {retry_timeout, 10000}, % TTL For the DLX queue.\n  {concurrency, 5}, % How many tasks to handle concurrently\n  {callback, sample_worker}, % Callback module\n  {callback_options, []} % Options sent to Callback:init/1\n]).\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelog%2Febunny_pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelog%2Febunny_pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelog%2Febunny_pool/lists"}