You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to setup the RPC server and client in a way that allows servers/services to be dynamically discovered by client processes.
Client Configuration
ServiceDirectory.startdo |config|
config.port=53000end# If your server also runs this code (say from an initializer),# it will default to the given port when sending# beacons and have its own service directory.# You can prevent this code from running on the server if needed:unlessdefined?(::Protobuf::CLI)ServiceDirectory.startdo |config|
config.port=53000endend
Server Configuration with Dynamic Discovery enabled
The client will listen on the specified port for beacons broadcast by servers. Each beacon includes a list of services provided by the broadcasting server. The client randomly selects a server for the desired service each time a request is made.
CAUTION: When running multiple environments on a single network, e.g., qa and staging, be sure that each environment is setup with a unique beacon port; otherwise, clients in one environment will make requests to servers in the other environment.
Check out the source for Protobuf::Rpc::ServiceDirectory for more details.