{"id":13508998,"url":"https://github.com/jsvisa/elixir_talk","last_synced_at":"2026-02-22T19:03:12.946Z","repository":{"id":14348425,"uuid":"17058012","full_name":"jsvisa/elixir_talk","owner":"jsvisa","description":"An Elixir client for beanstalkd","archived":false,"fork":false,"pushed_at":"2022-10-10T12:53:25.000Z","size":61,"stargazers_count":19,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-13T10:08:17.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/jsvisa.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-02-21T14:08:59.000Z","updated_at":"2023-12-09T11:14:42.000Z","dependencies_parsed_at":"2022-09-02T12:22:19.606Z","dependency_job_id":null,"html_url":"https://github.com/jsvisa/elixir_talk","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsvisa%2Felixir_talk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsvisa%2Felixir_talk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsvisa%2Felixir_talk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsvisa%2Felixir_talk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsvisa","download_url":"https://codeload.github.com/jsvisa/elixir_talk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314045,"owners_count":20757455,"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-08-01T02:01:01.564Z","updated_at":"2025-10-21T15:53:41.903Z","avatar_url":"https://github.com/jsvisa.png","language":"Elixir","funding_links":[],"categories":["Queue"],"sub_categories":[],"readme":"# ElixirTalk\n\n## Overview\n`ElixirTalk` is an Elixir client for [beanstalkd](http://kr.github.com/beanstalkd/).\nIt supported all commands defined in [Beanstalkd Protocol](https://raw.github.com/kr/beanstalkd/master/doc/protocol.txt)\n\n## Installation \u0026 Setup\n\nFirst, add ElixirTalk to your `mix.exs` dependencies:\n\n```elixir\ndef deps do\n  [{:elixir_talk, \"~\u003e 1.1\"}]\nend\n```\n\nand run `$ mix deps.get`.\n\n## Getting Started\nYou'll need **beanstalkd** listening at the host: `10.1.1.5`, and port: `14711`, simply start it with:\n`$ beanstalkd -l 10.1.1.5 -p 14711`\n\nStart the interactive shell and run the `ElixirTalk.connect` method to run it:\n\n    iex -S mix\n    iex(1)\u003e {:ok, pid} = ElixirTalk.connect('10.1.1.5', 14711)\nIf you leave out the two arguments, `'127.0.0.1'` and `11300` are the default value, also there is a `timeout` parameter\nwhich determines how long, **in millliseconds**, the socket will wait for **beanstalkd** to respond to its' initial\nconnection, default to `:infinity`.\n\n## Basic Operation\nAfter connection to the beanstalkd successfully, we can enqueue our jobs:\n\n    iex(2)\u003e ElixirTalk.put(pid, \"hello world\")\n    {:inserted, 1}\n\nOr we can get jobs:\n\n    iex(3)\u003e ElixirTalk.reserve(pid)\n    {:reserved, 1, \"hello world\"}\n\nOnce we are finishing a job, we have to delete it, otherwise jobs are re-queued by **beanstalkd**\nafter a `:ttr` \"time to run\" (60 seconds, per default) is surpassed. A job is marked as finished, by calling delete:\n\n    iex(4)\u003e ElixirTalk.delete(pid, 1)\n    :deleted\n\n`reserve` blocks until a job is ready, possibly forever. We can invoke reserve with a timeout **in seconds**,\nto indicate how long we want to wait to receive a job. If such a reserve times out, it will return `:timed_out`:\n\n    iex(5)\u003e ElixirTalk.reserve(pid, 5)\n    :timed_out\n\nIf you use a timeout of 0, reserve will immediately return either a job or `:timed_out`.\n\n## Tube Management\n\nA single **beanstalkd** server can provide many different queues, called \"tubes\" in **beanstalkd**.\nTo see all available tubes:\n\n    iex(6)\u003e ElixirTalk.list_tubes(pid)\n    [\"default\"]\n\nA **beanstalkd** client can choose one tube into which its job are putted. This is the tube \"used\" by the client.\nTo see what tube you are currently using:\n\n    iex(7)\u003e ElixirTalk.list_tube_used(pid)\n    {:using, \"default\"}\n\nUnless told otherwise, a client uses the `\"default\"` tube. If you want to use a different tube:\n\n    iex(8)\u003e ElixirTalk.use(pid, \"notDefault\")\n    {:using, \"notDefault\"}\n    iex(8)\u003e ElixirTalk.list_tube_used(pid)\n    {:using, \"notDefault\"}\n\nIf you decide to use a tube which does not yet exist, the tube is automatically created by **beanstalkd**, so you can see\nwe initially used the `\"default\"` tube. Of course, you can always switch back to the default tube.\nTubes that don't have any client using or watching, be vanished automatically:\n\n    iex(9)\u003e ElixirTalk.list_tubes(pid)\n    [\"default\", \"notDefault\"]\n    iex(10)\u003e ElixirTalk.use(pid, \"default\")\n    {:using, \"default\"}\n    iex(11)\u003e ElixirTalk.list_tubes(pid)\n    [\"default\"]\n\nFurther more, a beanstalkd client can choose many tubes to `reserve` jobs from. These tubes are `watched` by the client.\nTo see what tubes you are currently watching:\n\n    iex(12)\u003e ElixirTalk.list_tubes_watched(pid)\n    [\"default\"]\n\nTo watch an additional tube:\n\n    iex(13)\u003e ElixirTalk.watch(pid, \"notDefault\")\n    {:watching, 2}\n    iex(14)\u003e ElixirTalk.list_tubes_watched(pid)\n    [\"default\", \"notDefault\"]\n\nThe same to `use`, tubes that do not yet exist are created automatically once you start watching them.\n\nTo stop `watch` a tube:\n\n    iex(15)\u003e ElixirTalk.ignore(pid, \"default\")\n    {:watching, 1}\n    iex(16)\u003e ElixirTalk.list_tubes_watched(pid)\n    [\"notDefault\"]\n\nYou can't watch zero tubes. So if you try to ignore the last tube you are watching, this is silently return `:not_ignored`:\n\n    iex(17)\u003e ElixirTalk.ignore(pid, \"notDefault\")\n    :not_ignored\n    iex(18)\u003e ElixirTalk.list_tubes_watched(pid)\n    [\"notDefault\"]\n\nNote that `use` and `watch` these concerns are fully orthogonal: for example, when you use a tube, it is not\nautomatically watched. Neither does watching a tube affect the tube you are using. You may `use` a tube in one process\nto put your jobs, while in another process you `watch` a job just to get the putted jobs.\n\n## Statistics\n\n**ElixirTalkd** accumulates various statistics at the server, tube and job level. Statistical details for a job can only be retrieved during the job's lifecycle. So let's create another job:\n\n    %{\"age\" =\u003e 13, \"buries\" =\u003e 0, \"delay\" =\u003e 0, \"file\" =\u003e 0, \"id\" =\u003e 10,\n      \"kicks\" =\u003e 0, \"pri\" =\u003e 0, \"releases\" =\u003e 0, \"reserves\" =\u003e 1, \"state\" =\u003e \"reserved\",\n      \"time-left\" =\u003e 53, \"timeouts\" =\u003e 0, \"ttr\" =\u003e 60, \"tube\" =\u003e \"default\"}\n\nYou can't access a deleted or not existed job's stats, or you'll only get a `:not_found`.\n\n    iex(20)\u003e ElixirTalk.stats_job(pid, 26)\n    :not_found\n\nYou can also access a tube's statistics:\n\n    iex(21)\u003e ElixirTalk.stats_tube(pid, \"default\")\n    %{\"cmd-delete\" =\u003e 0, \"cmd-pause-tube\" =\u003e 0, \"current-jobs-buried\" =\u003e 0,\n      \"current-jobs-delayed\" =\u003e 0, \"current-jobs-ready\" =\u003e 1,\n      \"current-jobs-reserved\" =\u003e 0, \"current-jobs-urgent\" =\u003e 1,\n      \"current-using\" =\u003e 1, \"current-waiting\" =\u003e 0, \"current-watching\" =\u003e 1,\n      \"name\" =\u003e \"default\", \"pause\" =\u003e 0, \"pause-time-left\" =\u003e 0, \"total-jobs\" =\u003e 1}\n\nFinally, there's an abundant amount of server-level statistics accessible via the Connection's stats method:\n\n    iex(22)\u003e ElixirTalk.stats(pid)\n     %{\"current-jobs-urgent\" =\u003e 2, \"cmd-peek\" =\u003e 0, \"uptime\" =\u003e 1154,\n       \"cmd-list-tubes-watched\" =\u003e 3, \"rusage-utime\" =\u003e 0.0, \"cmd-release\" =\u003e 0,\n       \"binlog-current-index\" =\u003e 0, \"cmd-watch\" =\u003e 19, \"total-connections\" =\u003e 15,\n       \"current-workers\" =\u003e 1, \"current-waiting\" =\u003e 0, \"cmd-ignore\" =\u003e 15,\n       \"id\" =\u003e \"def32f0744b36db5\", \"cmd-put\" =\u003e 11, \"job-timeouts\" =\u003e 1,\n       \"cmd-stats-tube\" =\u003e 3, \"max-job-size\" =\u003e 65535, \"current-producers\" =\u003e 1,\n       \"current-jobs-buried\" =\u003e 0, \"cmd-touch\" =\u003e 0, \"cmd-kick\" =\u003e 0,\n       \"current-tubes\" =\u003e 2, \"cmd-bury\" =\u003e 0, \"current-jobs-ready\" =\u003e 2,\n       \"cmd-stats\" =\u003e 3, \"cmd-list-tube-used\" =\u003e 3, \"version\" =\u003e \"1.10+4+g96e8756\",\n       \"binlog-records-migrated\" =\u003e 0, \"hostname\" =\u003e \"v\",\n       \"binlog-records-written\" =\u003e 0, \"current-jobs-reserved\" =\u003e 0,\n       \"cmd-peek-ready\" =\u003e 0, \"cmd-pause-tube\" =\u003e 0, \"current-jobs-delayed\" =\u003e 0,\n       \"cmd-peek-buried\" =\u003e 0, \"cmd-use\" =\u003e 16, \"cmd-reserve\" =\u003e 2,\n       \"current-connections\" =\u003e 1, \"rusage-stime\" =\u003e 0.014314,\n       \"cmd-reserve-with-timeout\" =\u003e 2, \"binlog-oldest-index\" =\u003e 0, \"pid\" =\u003e 9987,\n       \"binlog-max-size\" =\u003e 10485760, \"total-jobs\" =\u003e 10, \"cmd-delete\" =\u003e 9,\n       \"cmd-list-tubes\" =\u003e 3, \"cmd-stats-job\" =\u003e 3, \"cmd-peek-delayed\" =\u003e 0}\n\n\n## Test\n\nIf you want to run the TestCase, you set the correct Beanstalkd IP and Port\nin [test/elixir_talk_test.exs](\"http://www.github.com/jsvisa/elixit_talk/test/elixir_talk_test.exs\"),\nalso you should set a hostname `my.beanstalkd.com` with the provided ip in */etc/hosts*\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsvisa%2Felixir_talk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsvisa%2Felixir_talk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsvisa%2Felixir_talk/lists"}