{"id":19692322,"url":"https://github.com/root27/go-rabbit","last_synced_at":"2026-07-03T22:02:07.347Z","repository":{"id":216455330,"uuid":"734266108","full_name":"root27/go-rabbit","owner":"root27","description":"https://pkg.go.dev/github.com/root27/go-rabbit","archived":false,"fork":false,"pushed_at":"2024-01-10T09:20:26.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T01:46:53.746Z","etag":null,"topics":[],"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/root27.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":"2023-12-21T09:06:38.000Z","updated_at":"2024-01-10T11:05:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"555386eb-8f6e-4647-92e8-7f6e5e92b11a","html_url":"https://github.com/root27/go-rabbit","commit_stats":null,"previous_names":["root27/go-rabbit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/root27/go-rabbit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-rabbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-rabbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-rabbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-rabbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/root27","download_url":"https://codeload.github.com/root27/go-rabbit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root27%2Fgo-rabbit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35102742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-11T19:12:59.362Z","updated_at":"2026-07-03T22:02:07.306Z","avatar_url":"https://github.com/root27.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rabbitmq Package for Golang\n\nIt includes basic operations for Rabbitmq. These operations are:\n\n- Basic Publish/Consumer\n- Publish/Consumer RPC\n\n\n## Installation\n\n```bash\n\ngo get github.com/root27/go-rabbit\n\n```\n\n## Usage\n\nSome usage examples are given below.\n\n### Basic Publish/Consumer\n\n- Basic Publish\n\n\n```go\n\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\n\tamqplib \"github.com/root27/go-rabbit\"\n)\n\nfunc main() {\n\n\t// Connect to RabbitMQ\n\tconn, err := amqplib.Connect(\"amqp://guest:guest@localhost:5672/\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tdefer conn.Close()\n\n\tlog.Printf(\"connected to RabbitMQ\")\n\n\t// Send a message\n\tmsg := SendMessage{\"message\": \"Hello World!\"}\n\n\tbyteData, err := json.Marshal(msg)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t_, err = amqplib.Send(conn, \"test2\", []byte(byteData), \"application/json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tlog.Printf(\"message sent: %s\", msg)\n\n}\n\ntype SendMessage map[string]interface{}\n\n```\n\n- Basic Consumer\n\n\n```go\n\npackage main\n\nimport (\n\t\"log\"\n\n\tamqplib \"github.com/root27/go-rabbit\"\n)\n\nfunc main() {\n\n\t// Connect to RabbitMQ\n\tconn, err := amqplib.Connect(\"amqp://guest:guest@localhost:5672/\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"connected to RabbitMQ\")\n\n\tlog.Printf(\"Messages waiting...\")\n\n\t// Receive a message\n\n\tmsgs, err := amqplib.Receive(conn, \"test2\")  // return a channel\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\n    // msgs is a channel, so we can use it in a for loop\n\n\n\tfor d := range msgs {\n\n\t\tlog.Printf(\"received a message: %s\", d)\n\n\t\tlog.Printf(\"Type of data received: %T\", d)\n\t}\n\n}\n\n```\n\n### Publish/Consumer RPC\n\n- Publish RPC\n\n```go\n\npackage main\n\nimport (\n\t\"log\"\n\t\"strconv\"\n\n\tamqplib \"github.com/root27/go-rabbit\"\n)\n\nfunc main() {\n\n\tconn, err := amqplib.Connect(\"amqp://guest:guest@localhost:5672/\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ttestData := strconv.Itoa(5)\n\n\n    // Send RPC accepts 4 parameters: connection, queue name, data, data type\n\n    // Returns consume RPC response\n\n\tresponse, err := amqplib.Send_Rpc(conn, \"test_rpc\", []byte(testData), \"text/plain\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Response: %s\", response)\n\n}\n\n```\n\n- Consumer RPC\n\n```go\n\npackage main\n\nimport (\n\t\"log\"\n\t\"strconv\"\n\n\tamqplib \"github.com/root27/go-rabbit\"\n)\n\nfunc main() {\n\n\tconn, err := amqplib.Connect(\"amqp://guest:guest@localhost:5672/\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Printf(\"Connected to RabbitMQ\")\n\n\tlog.Printf(\"Waiting for RPC requests...\")\n\n    // Receive RPC accepts 4 parameters: connection, queue name, function, data type\n\n\n    // Function must be a function that accepts a byte array and returns a byte array\n\n\n\tamqplib.Receive_Rpc(conn, \"test_rpc\", testFunction, \"text/plain\")\n\n}\n\nfunc testFunction(data []byte) []byte {\n\n\tinteger, err := strconv.Atoi(string(data))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn []byte(strconv.Itoa(integer * 2))\n\n}\n\n``````\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot27%2Fgo-rabbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froot27%2Fgo-rabbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot27%2Fgo-rabbit/lists"}