{"id":27404634,"url":"https://github.com/gavrilaf/amqp","last_synced_at":"2025-07-05T05:33:18.206Z","repository":{"id":66353754,"uuid":"123960361","full_name":"gavrilaf/amqp","owner":"gavrilaf","description":"RPC implementation over RabbitMQ","archived":false,"fork":false,"pushed_at":"2018-03-16T13:24:14.000Z","size":66,"stargazers_count":23,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T11:34:57.425Z","etag":null,"topics":["amqp","golang","rabbitmq","rpc"],"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/gavrilaf.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":"2018-03-05T18:23:27.000Z","updated_at":"2021-12-24T22:24:38.000Z","dependencies_parsed_at":"2023-02-22T06:31:07.598Z","dependency_job_id":null,"html_url":"https://github.com/gavrilaf/amqp","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/gavrilaf%2Famqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavrilaf%2Famqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavrilaf%2Famqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavrilaf%2Famqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavrilaf","download_url":"https://codeload.github.com/gavrilaf/amqp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830171,"owners_count":21168270,"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":["amqp","golang","rabbitmq","rpc"],"created_at":"2025-04-14T05:39:31.721Z","updated_at":"2025-04-14T05:39:32.169Z","avatar_url":"https://github.com/gavrilaf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"RPC implementation over RabbitMQ\n\n# Installation\n\nInstall the standard protocol buffer implementation from https://github.com/google/protobuf.\nInstall the gogo golang protobuf implementation from https://github.com/gogo/protobuf.\n\nInstall mq-rpc binary:\n\n`go get github.com/gavrilaf/amqp/protoc-gen-mqrpc`\n\n# Run example\n\nRun RabbitMQ locally or from Docker image\n\n`docker run --hostname my-rabbit -p 5672:5672 --name rabbit22 rabbitmq:3`\n\nRun amqp/examples/rpc-test-srv\n\n`go run server.go messages.pb.go messages_mqrpc.gen.go`\n\n`go run client.go messages.pb.go messages_mqrpc.gen.go`\n\n# Using library\n\nWrite service definition:\n```protobuf\nservice TestService {\n  rpc Ping (Empty) returns (ServerStatus);\n  rpc CreateUser(User) returns (ResourceID);\n  rpc CreateAccount(Account) returns (ResourceID);\n  rpc FindAccount(ResourceID) returns (Account);\n}\n\nmessage Empty {}\n\nmessage ResourceID {\n  string ID = 1;\n}\n\nmessage ServerStatus {\n  int32 status = 1; \n}\n......\n```\nGenerate types \u0026 service:\n```\nprotoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --gogofast_out=. *.proto\n\nprotoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --mqrpc_out=. *.proto\n```\n\nImpement server:\n``` golang\nfunc main() {\n  srv, err := rpc.CreateServer(\"amqp://localhost:5672\", \"rpc-rabbit-worker\")\n  RunServer(srv, \u0026srvHandler{})\n}\n\ntype srvHandler struct{}\n\nfunc (p srvHandler) Ping(arg *Empty) (*ServerStatus, error) {\n  fmt.Printf(\"Ping\\n\")\n  return \u0026ServerStatus{Status: 2}, nil\n}\n\nfunc (p srvHandler) CreateUser(user *User) (*ResourceID, error) {\n  fmt.Printf(\"CreateUser: %v\\n\", user.String())\n  return \u0026ResourceID{ID: uuid.NewV4().String()}, nil\n}\n\nfunc (p srvHandler) CreateAccount(acc *Account) (*ResourceID, error) {\n......\n```\n\nConnect to server and use service methods:\n``` golang\nfunc main() {\n  conn, err := rpc.Connect(rpc.ClientConfig{Url: \"amqp://localhost:5672\", \n                                            ServerQueue: \"rpc-rabbit-worker\", \n                                            Timeout: time.Second})\n  \n  client := NewTestServiceClient(conn)\n  \n  status, err := client.Ping(\u0026Empty{})\n\t\n  id1, err := client.CreateUser(\u0026User{Username: \"username\", PasswordHash: \"111\", Device: nil})\n......\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavrilaf%2Famqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavrilaf%2Famqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavrilaf%2Famqp/lists"}