Comments (3)
like, this code example is completely useless:
require 'gruf'
id = args[:id].to_i.presence || 1
begin
client = ::Gruf::Client.new(service: ::Demo::ThingService)
response = client.call(:GetMyThing, id: id)
puts response.message.inspect
rescue Gruf::Client::Error => e
puts e.error.inspect
end
Does that go in every place in the code, immediately before calling the client? I highly doubt it. You're assigning the client to a local var. Does this mean that every instance of a client is used for only one RPC call? Its very misleading / useless code example.
from gruf.
Hi @quinn - apologies for the lack of docs! Yes, we probably can add more here, but generally gruf follows the same concepts and behaviors as the Ruby gRPC client, which is where you instantiate a client object paired with a service stub, and then call actions on it.
You can make separate calls by just calling the call
method on the client multiple times, or call different methods. Similarly, you can use dependency injection to store an instance of the client app-wide, if you don't want to instantiate it in a class. Gruf is purposely unopinionated on this, to allow for flexibility in upstream systems.
from gruf.
Hi @quinn - I've added a wiki to the gruf repo: https://github.com/bigcommerce/gruf/wiki
You can find information about client creation here: https://github.com/bigcommerce/gruf/wiki/Client%3A-Installation and following.
This should have plenty of detail to get you started. I'll keep augmenting this further in the next few weeks. Thanks for the feedback!
from gruf.
Related Issues (20)
- Please release 2.13.2 HOT 4
- Next step in `Server:-Creating-Controllers.md` not linked HOT 1
- Starting Gruf and bind with specific controllers HOT 4
- After Zeitwerk upgrade, specs don't autoload controller names HOT 7
- Request context for interceptors to communicate information back to controllers HOT 2
- 2.16 appears to autoload the HealthCheck even if not enabled HOT 1
- Minor typo in wiki, recommended fix :) HOT 1
- Gruf.controllers_path unloaded even in client mode HOT 2
- Question: is hot code reloading for other paths possible? HOT 1
- healthcheck cannot be seperated of main thread limit HOT 1
- Autoloading in development is not thread-safe HOT 3
- enabling TLS default
- Allow gruf to receive request objects in `call` HOT 2
- Ruby does not generate correct proto with ruby version 3.1.0 and 3.2.0 HOT 2
- Wiki: update instrumentation docs to rename blacklist to blocklist, since that's what it is in the code. HOT 1
- Ruby 3.3.0 support HOT 1
- Gruf server stuck at starting HOT 1
- Rails 7.1: DEPRECATION WARNING: Calling `ActiveRecord::Base.clear_active_connections! is deprecated. Please call the method directly on the connection handler; for example: `ActiveRecord::Base.connection_handler.clear_active_connections! HOT 1
- Did release 2.17.0 break call concurrency? HOT 9
- Use `ActiveSupport::Notifications::Instrument` instead of `event_listener_proc`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gruf.