{"id":20981066,"url":"https://github.com/unikorp/workmq","last_synced_at":"2025-10-04T08:02:00.052Z","repository":{"id":57607972,"uuid":"97883862","full_name":"unikorp/workmq","owner":"unikorp","description":"A message queue system written in Go","archived":false,"fork":false,"pushed_at":"2017-10-24T11:43:34.000Z","size":228,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T20:11:26.896Z","etag":null,"topics":["go","golang","message","message-queue","queue","worker","workers"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/unikorp.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":"2017-07-20T22:40:28.000Z","updated_at":"2022-04-19T05:32:48.000Z","dependencies_parsed_at":"2022-09-03T06:23:56.548Z","dependency_job_id":null,"html_url":"https://github.com/unikorp/workmq","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/unikorp%2Fworkmq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unikorp%2Fworkmq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unikorp%2Fworkmq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unikorp%2Fworkmq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unikorp","download_url":"https://codeload.github.com/unikorp/workmq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254182701,"owners_count":22028346,"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","golang","message","message-queue","queue","worker","workers"],"created_at":"2024-11-19T05:33:32.640Z","updated_at":"2025-10-04T08:01:59.984Z","avatar_url":"https://github.com/unikorp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"WorkMQ\n======\n\nA message queue system written in Go.\n\nThis is a message queue implementation written in Go.\nIt allows to declare some queues, number of workers and processors that will process data sent in these queues.\n\nInitially used for a Golang workshop study case, we've decided to put it open-source.\n\n![Schema](doc/schema.jpg)\n\n# Installation\n\nFirst, install it:\n\n```go\n$ go get -u github.com/unikorp/workmq\n```\n\nThen, import it in your application code:\n\n```go\nimport (\n    \"github.com/unikorp/workmq\"\n)\n```\n\n# Configuration\n\nQueues and workers configuration is managed using a `config.json` file in the root directory.\n\nHere is an example JSON with 2 queues, listening on UDP port and exposing the given HTTP port:\n\n```json\n{\n  \"ports\": {\n    \"udp\": \":10001\",\n    \"http\": \":8080\"\n  },\n  \"queues\": {\n    \"queue.1s\": {\n      \"processor\": \"processor.logger.1s\",\n      \"num_workers\": 150\n    },\n    \"queue.2s\": {\n      \"processor\": \"processor.logger.2s\",\n      \"num_workers\": 200\n    }\n  }\n}\n```\n\nHere, we have 2 queues:\n* `queue.1s` that will be processed by registered processor `processor.logger.1s` and will use 150 workers (goroutines),\n* `queue.2s` that will be processed by registered processor `processor.logger.2s` and will use 200 workers (goroutines).\n\n# Usage\n\nHere is a code example that initializes WorkMQ, registers a processor and start handling messages:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/unikorp/workmq\"\n)\n\nfunc main() {\n\tapp := workmq.Init()\n\n\tapp.AddProcessor(\"processor.logger.1s\", func(worker *workmq.Worker, message workmq.Message) {\n\t\ttime.Sleep(time.Second * 1)\n\n\t\tfmt.Printf(\"Worker #%d (queue: \\\"%s\\\") manages message %s\\n\", worker.ID, worker.Queue, message.Body)\n\t})\n\n\tapp.Handle()\n}\n\n```\n\n# Send data\n\nYou can send message data over UDP by sending a JSON string with the following structure:\n\n```\n{ \"queue\": \"queue.1s\", \"body\": \"\u003cyour data\u003e\" }\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funikorp%2Fworkmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funikorp%2Fworkmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funikorp%2Fworkmq/lists"}