{"id":16305231,"url":"https://github.com/moznion/jesque-robust-worker-pool","last_synced_at":"2025-10-25T14:30:31.263Z","repository":{"id":36387126,"uuid":"40692009","full_name":"moznion/jesque-robust-worker-pool","owner":"moznion","description":"An implementation of worker pooling for jesque","archived":false,"fork":false,"pushed_at":"2015-08-18T03:45:18.000Z","size":180,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-31T07:34:20.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moznion.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":"2015-08-14T02:35:53.000Z","updated_at":"2022-11-17T09:17:39.000Z","dependencies_parsed_at":"2022-07-09T14:31:09.143Z","dependency_job_id":null,"html_url":"https://github.com/moznion/jesque-robust-worker-pool","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Fjesque-robust-worker-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Fjesque-robust-worker-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Fjesque-robust-worker-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Fjesque-robust-worker-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moznion","download_url":"https://codeload.github.com/moznion/jesque-robust-worker-pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238155463,"owners_count":19425719,"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-10T21:06:04.829Z","updated_at":"2025-10-25T14:30:31.006Z","avatar_url":"https://github.com/moznion.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"jesque-robust-worker-pool [![Build Status](https://travis-ci.org/moznion/jesque-robust-worker-pool.svg)](https://travis-ci.org/moznion/jesque-robust-worker-pool)\n=============\n\nAn implementation of worker pooling for [jesque](https://github.com/gresrun/jesque).\nIt monitors status of pooling workers and if it detects died worker then adjust number of workers.\n\nSynopsis\n---\n\n```java\nfinal Config config = new ConfigBuilder().build();\nfinal Map\u003cString, Class\u003c? extends Runnable\u003e\u003e actionMap = new HashMap\u003c\u003e();\nactionMap.put(\"TestAction\", TestAction.class);\n\nfinal RobustWorkerPool workerPool = new RobustWorkerPool(() -\u003e\n    new WorkerImpl(config, Collections.singletonList(\"foo\"), new MapBasedJobFactory(actionMap)),\n    10, Executors.defaultThreadFactory());\n\n// Highly recommend: Handling to recover for `WORKER_ERROR` event should be set like so:\nworkerPool.getWorkerEventEmitter().addListener(\n    (event, worker, queue, errorJob, runner, result, t) -\u003e {\n        log.info(\"Something handling to recover a worker when it fires `WORKER_ERROR` event\");\n        log.info(\"You have the option of implementing error handling.\");\n        // Do something\n    }, WorkerEvent.WORKER_ERROR\n)\n\nworkerPool.run();\n\n// Uncomment followings with a situation.\n// workerPool.end(false);\n// workerPool.endAndJoin(false, 0);\n// ...\n```\n\nRequires\n--\n\n- Java 8 or later\n- Jesque 2.0.2 or later\n\nMotivation\n--\n\n`WorkerPool` is an implementation of worker pooling which is provided by jesque core.\nHowever that doesn't have any interest in worker's status, alive or not.\nMeans worker will not revive even if any workers die on polling.\n\nSuch behavior is not robust if making workers work long hours.\nSo I make this implementation. This worker pool monitors about worker is alive or not.\nIt also adjust number of workers (if missing workers exist then make new workers, and vice versa)\nautomatically when a worker is stopped.\n\nFeatures (different from original `WorkerPool`)\n--\n\n- Monitors status of pooled workers, dead or alive.\n- Adjust number of active workers. When a pooled worker is died on polling, manager will create a new worker and join it into pool.\n\nTips\n--\n\n### How to add a listener for any event?\n\nUse `robustWorkerPool.getWorkerEventEmitter().addListener()` method. Please also refer to the above synopsis.\n\nSee Also\n--\n\n- [jesque](https://github.com/gresrun/jesque)\n\nAuthor\n--\n\nmoznion (\u003cmoznion@gmail.com\u003e)\n\nLicense\n--\n\n```\nCopyright 2011 Greg Haines\nCopyright 2015 moznion, http://moznion.net/ \u003cmoznion@gmail.com\u003e\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoznion%2Fjesque-robust-worker-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoznion%2Fjesque-robust-worker-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoznion%2Fjesque-robust-worker-pool/lists"}