{"id":20795890,"url":"https://github.com/g41797/beanstalkz","last_synced_at":"2025-04-15T03:00:21.244Z","repository":{"id":262080453,"uuid":"886122021","full_name":"g41797/beanstalkz","owner":"g41797","description":"Zig client for Beanstalkd - simple and fast general purpose work queue","archived":false,"fork":false,"pushed_at":"2025-01-02T09:12:42.000Z","size":701,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T14:43:08.903Z","etag":null,"topics":["background-jobs","beanstalkd","consumer","job-queue","producer","submitter","worker","zig-library","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/g41797.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-10T08:59:57.000Z","updated_at":"2025-01-18T08:35:08.000Z","dependencies_parsed_at":"2024-12-07T09:21:32.416Z","dependency_job_id":"75b5a4c0-6e3a-47a7-b2e5-ec0b442061cb","html_url":"https://github.com/g41797/beanstalkz","commit_stats":null,"previous_names":["g41797/beanstalk","g41797/beanstalkz"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fbeanstalkz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fbeanstalkz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fbeanstalkz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fbeanstalkz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g41797","download_url":"https://codeload.github.com/g41797/beanstalkz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997095,"owners_count":21195798,"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":["background-jobs","beanstalkd","consumer","job-queue","producer","submitter","worker","zig-library","zig-package"],"created_at":"2024-11-17T16:24:34.027Z","updated_at":"2025-04-15T03:00:21.225Z","avatar_url":"https://github.com/g41797.png","language":"Zig","funding_links":[],"categories":["Network \u0026 Web"],"sub_categories":["Network"],"readme":"![](_logo/1p0c_8c0637.jpg)\n\n# Zig client for Beanstalkd\n[![CI](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml/badge.svg)](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml)\n\n\n[Beanstalkd](https://pmatseykanets.github.io/beanstalkd-docs/) is\n\u003e             Simple and fast general purpose work queue.\n\u003e         The beauty of Beanstalkd is its absolute simplicity.\n\n\nActually you can use just 3 commands\n\n- submit(put) job into the queue\n- take(reserve) job from the queue for processing\n- delete job from the queue\n\n```zig\n    // On producer side\n    _ = try producer.put(1, 0, 120, \"job data\");\n    \n    // On worker side\n    var job: Job = .{};\n    try job.init(allocator);\n    defer job.deinit();\n    \n    try worker.reserve(10, \u0026job);\n        \n    // job.body().? - contains \"job data\"\n    // process job\n    // ...........\n    \n    // job.id().?   - contains job id\n    try worker.delete(job.id().?);\n```\nBeanstalkd is the part of main distros, you can install it using [appropriate package manager](https://pmatseykanets.github.io/beanstalkd-docs/guide/installation.html).\n\nAnd of course you can use Beanstalkd [with Docker](https://hub.docker.com/search?q=beanstalkd).  \n\nIf you don't have experience using `Beanstalkd`, it's a good idea to read:\n- [beanstalkd protocol](https://pmatseykanets.github.io/beanstalkd-docs/protocol/)\n- [beanstalkd FAQ](https://pmatseykanets.github.io/beanstalkd-docs/resources/faq.html)\n\n## Job\n\n*Job* is opaque array of bytes. Beanstalkd does not force you to use a specific data format.\n\nAfter being placed in a queue, job can be in the following states:\n\n- delayed (waiting for time-out before moving to next state) \n- ready (for processing)\n- reserved (processed)\n- buried (failed)\n\n\n## Job lifecycle supported by beanstalkz\n```txt\n  'put' with delay                                'delete'             \n  ----------------\u003e [DELAYED] ---------------------------X\n                        |     \n                        | 'kick-job' or time passes\n                        |              \n  'put'                 v     'reserve'           'delete'\n  -----------------\u003e [READY] ---------\u003e [RESERVED] ------X\n                       |  ^                 |  \n                       |  |                 | 'bury'\n                       |  |   'kick-job'    v     'delete'\n                       |   `------------ [BURIED]  ------X    \n                       |                  \n                       |                          'delete'\n                        `--------------------------------X\n```\n\n\n## Tube\n\nInstead of the term _queue_ Beanstalkd uses term _tube_,\nthis explains the picture above.\n\n*Tube* is _named queue_. \n\u003eTubes are created on demand whenever they are referenced.\n\u003e \n\u003e If a tube is empty (that is, it contains no ready, delayed, or buried jobs)\n\u003e \n\u003e and no client refers to it, it will be deleted.\n\nIf tube was not referenced, Beanstalkd creates *\"default\"* tube.\n\nEvery tube has 3 sub-queues:\n\n- delay - contains jobs in _delayed_ state\n- ready - contains jobs in _ready_ or _reserved_ states\n- bury (dead-letter) - contains failed jobs\n\n## Supported commands\n\n| Name                                                                                     |                 Description                  |                                                                API                                                                |\n|:-----------------------------------------------------------------------------------------|:--------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------:|\n| [use](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L178)        |           Set current tube(queue)            |                   [use(tname: []const u8)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L116)                    |\n| [put](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L124)        |          Submit job to current tube          |    [put(pri: u32, delay: u32, ttr: u32, job: []const u8)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L139)     |\n| [watch](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L347)      |   Subscribe to jobs submitted to the tube    |                  [watch(tname: []const u8)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L243)                   |\n| [reserve](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L203)    |                 Consume job                  |              [reserve(timeout: u32, job: *Job)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L272)               |\n| [bury](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L310)       |    Put job to the failed(\"buried\") state     |                   [bury(id: u32, pri: u32)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L308)                   |\n| [kick-job](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L424)   | Put delayed or failed job to the ready state |                      [kick_job(id: u32)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L342)                      |\n| [ignore](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L363)     |                 Un-subscribe                 |                  [ignore(tname: []const u8)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L383)                  |\n| [delete](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L271)     |          Remove job from the system          |                       [delete(id: u32)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L369)                       |\n| [state](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L465)      |                Get job state                 |                       [state(id: u32)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L198)                        |\n| connect                                                                                  |                   Connect                    | [connect(allocator: Allocator, addr: ?[]const u8, port: ?u16)](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L48) |\n| [disconnect](https://github.com/beanstalkd/beanstalkd/blob/master/doc/protocol.txt#L728) |                  Disconnect                  |                         [disconnect()](https://github.com/g41797/beanstalkz/blob/main/src/client.zig#L84)                         |\n  \n \n\n\n## Installation\n\nAdd *beanstalkz* to build.zig.zon:\n```bach\nzig fetch --save=beanstalkz git+https://github.com/g41797/beanstalkz\n```\n\nAdd *beanstalkz* to build.zig:\n```zig\n    const beanstalkz = b.dependency(\"beanstalkz\", .{\n        .target = target,\n        .optimize = optimize,\n    });\n\n    const lib = b.addStaticLibrary(..);\n    lib.root_module.addImport(\"beanstalkz\", beanstalkz.module(\"beanstalkz\"));\n\n    const lib_unit_tests = b.addTest(...);\n    lib_unit_tests.root_module.addImport(\"beanstalkz\", beanstalkz.module(\"beanstalkz\"));\n```\n\nImport *beanstalkz*:\n```zig\nconst beanstalkz = @import(\"beanstalkz\");\n```\n\n\n## Credits\nContent of README is heavily inspired by \n- [README of jackd](https://github.com/getjackd/jackd#jackd)\n- [Giant Killing with Beanstalkd](https://www.sitepoint.com/giant-killing-with-beanstalkd/)\n \n## License\n[MIT](LICENSE)\n\n\u003cbr /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg41797%2Fbeanstalkz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg41797%2Fbeanstalkz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg41797%2Fbeanstalkz/lists"}