{"id":13413410,"url":"https://github.com/socifi/jazz","last_synced_at":"2025-04-07T21:32:17.946Z","repository":{"id":57487769,"uuid":"154139907","full_name":"socifi/jazz","owner":"socifi","description":"Abstraction layer for simple rabbitMQ connection, messaging and administration","archived":false,"fork":false,"pushed_at":"2019-03-21T11:10:11.000Z","size":35,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T20:52:19.554Z","etag":null,"topics":["golang","queue","rabbitmq"],"latest_commit_sha":null,"homepage":"","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/socifi.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":"2018-10-22T12:28:15.000Z","updated_at":"2023-06-28T09:06:17.000Z","dependencies_parsed_at":"2022-08-29T11:21:47.500Z","dependency_job_id":null,"html_url":"https://github.com/socifi/jazz","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/socifi%2Fjazz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socifi%2Fjazz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socifi%2Fjazz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socifi%2Fjazz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socifi","download_url":"https://codeload.github.com/socifi/jazz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247732671,"owners_count":20986899,"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":["golang","queue","rabbitmq"],"created_at":"2024-07-30T20:01:39.709Z","updated_at":"2025-04-07T21:32:14.233Z","avatar_url":"https://github.com/socifi.png","language":"Go","readme":"# Jazz\n\nAbstraction layer for quick and simple rabbitMQ connection, messaging and administration. Inspired by Jazz Jackrabbit and his eternal hatred towards slow turtles.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/en/b/b4/Jazz_Jackrabbit.jpg\" alt=\"Jazz Jackrabbit\"\u003e\n\u003c/p\u003e\n\n\n## Usage\n\nThis library contains three major parts - exchange/queue scheme creation, publishing of messages and consuming of messages. The greatest benefit of this partitioning is that each part might be in separate application. Also due to dedicated administration part, publishing and consuming of messages is simplified to great extent.\n\n### Step 1: Connect to rabbit\n\n```golang\nimport(\n\t\"github.com/socifi/jazz\"\n)\n\nvar dsn = \"amqp://guest:guest@localhost:5672/\"\n\nfunc main() {\n\t// ...\n\n\tc, err := jazz.Connect(dsn)\n\tif err != nil {\n\t\tt.Errorf(\"Could not connect to RabbitMQ: %v\", err.Error())\n\t\treturn\n\t}\n\n\t//...\n}\n```\n\n### Step 2: Create scheme\n\nScheme specification is done via structure `Settings` which can be easily specified in YAML. So generally you need to decode YAML and then create all queues and exchanges\n\nIt can be something really crazy like this!\n\n```golang\nvar data = []byte(`\nexchanges:\n  exchange0:\n    durable: true\n    type: topic\n  exchange1:\n    durable: true\n    type: topic\n    bindings:\n      - exchange: \"exchange0\"\n        key: \"key1\"\n      - exchange: \"exchange0\"\n        key: \"key2\"\n  exchange2:\n    durable: true\n    type: topic\n    bindings:\n      - exchange: \"exchange0\"\n        key: \"key3\"\n      - exchange: \"exchange1\"\n        key: \"key2\"\n  exchange3:\n    durable: true\n    type: topic\n    bindings:\n      - exchange: \"exchange0\"\n        key: \"key4\"\nqueues:\n  queue0:\n    durable: true\n    bindings:\n      - exchange: \"exchange0\"\n        key: \"key4\"\n  queue1:\n    durable: true\n    bindings:\n      - exchange: \"exchange1\"\n        key: \"key2\"\n  queue2:\n    durable: true\n    bindings:\n      - exchange: \"exchange1\"\n        key: \"#\"\n  queue3:\n    durable: true\n    bindings:\n      - exchange: \"exchange2\"\n        key: \"#\"\n  queue4:\n    durable: true\n    bindings:\n      - exchange: \"exchange3\"\n        key: \"#\"\n  queue5:\n    durable: true\n    bindings:\n      - exchange: \"exchange0\"\n        key: \"#\"\n`)\n\nfunc main() {\n\t// ...\n\n\treader := bytes.NewReader(data)\n\tscheme, err := DecodeYaml(reader)\n\tif err != nil {\n\t\tt.Errorf(\"Could not read YAML: %v\", err.Error())\n\t\treturn\n\t}\n\n\terr = c.CreateScheme(scheme)\n\tif err != nil {\n\t\tt.Errorf(\"Could not create scheme: %v\", err.Error())\n\t\treturn\n\t}\n\n\t//...\n\n\t// Be nice and delete scheme (Not advisable in ).\n\terr = c.DeleteScheme(scheme)\n\tif err != nil {\n\t\tt.Errorf(\"Could not delete scheme: %v\", err.Error())\n\t\treturn\n\t}\n}\n```\n\n### Step 3: Publish and/or consume messages\n\nYou can process each queue in separate application or everything together like this:\n\n```golang\nfunc main() {\n\t// ...\n\n\tf := func(msg []byte) {\n\t\tfmt.Println(string(msg))\n\t}\n\n\tgo c.ProcessQueue(\"queue1\", f)\n\tgo c.ProcessQueue(\"queue2\", f)\n\tgo c.ProcessQueue(\"queue3\", f)\n\tgo c.ProcessQueue(\"queue4\", f)\n\tgo c.ProcessQueue(\"queue5\", f)\n\tgo c.ProcessQueue(\"queue6\", f)\n\tc.SendMessage(\"exchange0\", \"key1\", \"Hello World!\")\n\tc.SendMessage(\"exchange0\", \"key2\", \"Hello!\")\n\tc.SendMessage(\"exchange0\", \"key3\", \"World!\")\n\tc.SendMessage(\"exchange0\", \"key4\", \"Hi!\")\n\tc.SendMessage(\"exchange0\", \"key5\", \"Again!\")\n\n\t//...\n}\n```\n\n## Notes\n\n\u003csub\u003e\u003csup\u003eNo copyright infringement intended. The name Jazz Jackrabbit and artwork of Jazz Jackrabbit is intelectual property of Epic MegaGames and was taken over from [wikipedia](https://en.wikipedia.org/wiki/File:Jazz_Jackrabbit.jpg)\u003c/sup\u003e\u003c/sub\u003e\n","funding_links":[],"categories":["Messaging","消息系统","消息","机器学习","Relational Databases"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","SQL 查询语句构建库","检索及分析资料库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocifi%2Fjazz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocifi%2Fjazz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocifi%2Fjazz/lists"}