{"id":18186459,"url":"https://github.com/beautydate/grpc-kit","last_synced_at":"2025-04-02T01:32:13.534Z","repository":{"id":56875416,"uuid":"81455523","full_name":"beautydate/grpc-kit","owner":"beautydate","description":"GRPC toolkit for microservices","archived":false,"fork":false,"pushed_at":"2017-08-18T21:32:24.000Z","size":20,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-16T04:41:13.279Z","etag":null,"topics":["grpc","grpc-kit","grpc-toolkit","microservice","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/beautydate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-09T13:58:07.000Z","updated_at":"2018-07-24T19:44:28.000Z","dependencies_parsed_at":"2022-08-20T22:30:45.052Z","dependency_job_id":null,"html_url":"https://github.com/beautydate/grpc-kit","commit_stats":null,"previous_names":["b2beauty/grpc-kit"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautydate%2Fgrpc-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautydate%2Fgrpc-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautydate%2Fgrpc-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beautydate%2Fgrpc-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beautydate","download_url":"https://codeload.github.com/beautydate/grpc-kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246730294,"owners_count":20824396,"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-kit","grpc-toolkit","microservice","ruby"],"created_at":"2024-11-03T00:03:03.163Z","updated_at":"2025-04-02T01:32:13.248Z","avatar_url":"https://github.com/beautydate.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GRPC::Kit\n\nGRPC toolkit for microservices\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'grpc-kit'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install grpc-kit\n\n## Documentation\n\n- [`GRPC::Kit::Communication::Resilient`](#grpckitcommunicationresilient)\n- [`GRPC::Kit::Logger`](#grpckitlogger)\n- [`GRPC::Kit::Queue::Publisher`](#grpckitqueuepublisher)\n- [`GRPC::Kit::Queue::Worker`](#grpckitqueueworker)\n\n### GRPC::Kit::Communication::Resilient\n\nSometimes, GRPC and Google::Cloud raises _unavailable error_, but you can retry and all works fine. Based on [Datastore documentation](https://cloud.google.com/appengine/articles/handling_datastore_errors#timeouts-due-to-datastore-issues) we implemented a _helper_ for _resilient communication_.\n\nExample:\n\n```ruby\npubsub = Google::Cloud::Pubsub.new\ntopic  = pubsub.create_topic('topic_name')\ntopic.publish('message') # receives Google::Cloud::UnavailableError\n\n# But you can uses resilient communication\ninclude GRPC::Kit::Communication::Resilient\ntopic = resilient { topic.publish('message') }\n\n# And you can sets the limit of repetition...\ntopic = resilient(limit: 5) { topic.publish('message') }\n```\n\n### GRPC::Kit::Logger\n\nBy default all logs sent to `GRPC.logger` are ignored. But `GRPC::Kit::Logger` automatically configures logs to use _STDOUT_.\n\n### GRPC::Kit::Queue::Publisher\n\nTo publish a message to topic (creating one if none exists) you only need to configure environment variables for `Google::Cloud::Pubsub` and use:\n\n```ruby\nGRPC::Kit::Queue::Publisher.publish('topic_name', 'message')\n```\n\n### GRPC::Kit::Queue::Worker\n\nCreate a class in `lib/workers` including `GRPC::Kit::Queue::Worker`:\n\n```ruby\n# lib/workers/my_worker.rb\nclass MyWorker\n  include GRPC::Kit::Queue::Worker\n\n  def initialize(msg)\n    @msg = msg\n  end\n\n  def call\n    puts @msg.data\n    @msg.ack!\n  end\nend\n```\n\nAnd you can use:\n\n```bash\n# to list available workers\ngrpc-kit workers list\n# to run a worker\ngrpc-kit workers runner MyWorker topic_name\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/b2beauty/grpc-kit.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeautydate%2Fgrpc-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeautydate%2Fgrpc-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeautydate%2Fgrpc-kit/lists"}