{"id":13833738,"url":"https://github.com/asoorm/tyk-rmq-middleware","last_synced_at":"2025-07-15T12:31:37.675Z","repository":{"id":73623096,"uuid":"143718450","full_name":"asoorm/tyk-rmq-middleware","owner":"asoorm","description":"Example RMQ RPC middleware with Tyk","archived":false,"fork":false,"pushed_at":"2018-08-06T22:47:09.000Z","size":2845,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T09:36:59.704Z","etag":null,"topics":["grpc","grpc-go","plugins","rabbitmq","rpc","tyk","tyk-gateway"],"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/asoorm.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-08-06T11:22:22.000Z","updated_at":"2021-01-14T16:57:58.000Z","dependencies_parsed_at":"2024-07-27T09:02:56.046Z","dependency_job_id":null,"html_url":"https://github.com/asoorm/tyk-rmq-middleware","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/asoorm%2Ftyk-rmq-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asoorm%2Ftyk-rmq-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asoorm%2Ftyk-rmq-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asoorm%2Ftyk-rmq-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asoorm","download_url":"https://codeload.github.com/asoorm/tyk-rmq-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226038826,"owners_count":17564046,"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":["grpc","grpc-go","plugins","rabbitmq","rpc","tyk","tyk-gateway"],"created_at":"2024-08-04T13:00:24.461Z","updated_at":"2024-11-23T12:11:33.391Z","avatar_url":"https://github.com/asoorm.png","language":"Go","funding_links":[],"categories":["GoLang / RabbitMQ / RPC"],"sub_categories":[],"readme":"## Get running\n\n```\n$ docker-compose up -d\n\nCreating network \"tyk-rmq-middleware_default\" with the default driver\nCreating tyk-rmq-middleware_rmq_1 ... done\nCreating tyk-rmq-middleware_worker_1          ... done\nCreating tyk-rmq-middleware_middleware-grpc_1 ... done\n```\n\nThis will start a RMQ server listening on port `5672` for messages, and `15672` admin interface.\nTo access the admin interface, visit `http://localhost:15672` and login with highly secure credentials `guest:guest`.\n\nThe worker is a golang app - which simply listens on the `rpc_queue` queue, and replies to messages on the `reply_to`\nqueue with `correlation_id` from the incoming request.\n\n## Import API definition\n\nImport `./apidefinitions/sentence_generator.json` into Tyk Dashboard as a new API.\n\n## See it working\n\n```\n$ curl -X POST  http://localhost:8080/httpbin/post -d '{\"firstName\": \"Ahmet\"}'\n{\n    \"error\": \"lastName: lastName is required; age: age is required\"\n}\n```\n\nOk, so when we fix the request - meeting validation rules:\n\n```\n$ curl -X POST  http://localhost:8080/httpbin/post -d '{\"firstName\": \"Ahmet\", \"lastName\": \"Soormally\", \"age\": 36}'\n\n{\"sentence\":\"Ahmet Soormally is 36 year's old\"}\n```\n\nWhat just happened?\n\n1. Tyk validated the incoming request with JSON Schema validate JSON plugin.\n2. Tyk called gRPC middleware POST hook `MyRabbitHook`\n3. `MyRabbitHook` created a temporary `reply_to` queue, with a random `correlation_id` Then sent a message to\n`rpc_queue` for a worker to pick up.\n4. `worker` process was listening to `rpc_queue` for messages, and when it received the message, generated the sentence\nbased on body contents.\n5. Once it generated the response body, it placed the message onto the temporary `reply_to` queue with appropriate\n`correlation_id`.\n\n## Note\n\nThis is a PoC. I would highly recommend that `middleware-grpc` didn't establish a connection \u0026 disconnect from rabbit\nfor every RPC call.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasoorm%2Ftyk-rmq-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasoorm%2Ftyk-rmq-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasoorm%2Ftyk-rmq-middleware/lists"}