{"id":19180801,"url":"https://github.com/xpzouying/go-example-task-queue","last_synced_at":"2025-02-23T02:18:42.872Z","repository":{"id":73177269,"uuid":"275377990","full_name":"xpzouying/go-example-task-queue","owner":"xpzouying","description":"The example of task queue in Golang without any dependences.","archived":false,"fork":false,"pushed_at":"2020-06-27T13:31:15.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-28T23:16:03.355Z","etag":null,"topics":["go-examples","go-tutorials","task-queue","taskqueue"],"latest_commit_sha":null,"homepage":"","language":"Go","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/xpzouying.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":"2020-06-27T13:29:56.000Z","updated_at":"2024-06-19T11:13:44.694Z","dependencies_parsed_at":null,"dependency_job_id":"83ba907e-e45e-406a-9bee-11392432298f","html_url":"https://github.com/xpzouying/go-example-task-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgo-example-task-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgo-example-task-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgo-example-task-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgo-example-task-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpzouying","download_url":"https://codeload.github.com/xpzouying/go-example-task-queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240258357,"owners_count":19772988,"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":["go-examples","go-tutorials","task-queue","taskqueue"],"created_at":"2024-11-09T10:51:10.059Z","updated_at":"2025-02-23T02:18:42.850Z","avatar_url":"https://github.com/xpzouying.png","language":"Go","readme":"# Task Queue in Golang\n\nThe example for task queue in Golang without any dependences.\n\n![](./job_queue.jpg)\n\n## The Conception\n\n- Server: manage task and worker\n- Worker: the task worker\n- Worker Pool: in the same worker pool, the worker's capability is same.\n\n## Workflow\n\nThe workflow in main\n\n### 1. Init\n\n- create a server for managing task and worker\n- create 2 workers for `add` tasks\n- create 1 workers for `sub` tasks\n\n### 2. Run task\n\nCreate 10 tasks to run.\n\n## Run code and Result\n\n```bash\ngo run .\n```\n\nResult\n\n```\n2020/06/27 21:12:02 DEBUG: worker=add-worker-1 result=100\n2020/06/27 21:12:02 result: 100\n2020/06/27 21:12:02 DEBUG: worker=sub-worker-0 result=-99\n2020/06/27 21:12:02 result: -99\n2020/06/27 21:12:02 DEBUG: worker=add-worker-0 result=102\n2020/06/27 21:12:02 result: 102\n2020/06/27 21:12:02 DEBUG: worker=sub-worker-0 result=-97\n2020/06/27 21:12:02 result: -97\n2020/06/27 21:12:02 DEBUG: worker=add-worker-1 result=104\n2020/06/27 21:12:02 result: 104\n2020/06/27 21:12:02 DEBUG: worker=sub-worker-0 result=-95\n2020/06/27 21:12:02 result: -95\n2020/06/27 21:12:02 DEBUG: worker=add-worker-0 result=106\n2020/06/27 21:12:02 result: 106\n2020/06/27 21:12:02 DEBUG: worker=sub-worker-0 result=-93\n2020/06/27 21:12:02 result: -93\n2020/06/27 21:12:02 DEBUG: worker=add-worker-1 result=108\n2020/06/27 21:12:02 result: 108\n2020/06/27 21:12:02 DEBUG: worker=sub-worker-0 result=-91\n2020/06/27 21:12:02 result: -91\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpzouying%2Fgo-example-task-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpzouying%2Fgo-example-task-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpzouying%2Fgo-example-task-queue/lists"}