Am I able to call my ruby backend functions from my grpc server? I have a standard rails app that I am now trying to add grpc to so that outside apps can call a grpc api endpoint to do things through my existing app. Right now I have a standard file structure with app/components, app/models, etc and at the root I have added a /grpc directory with the server, lib, and a protos folder as well. My question is, on the server how can I call my existing ruby functions in my app?
For instance how could I do a call from my grpc server to a class like MyModule::MyClass.store_this_thing_to_the_db(parameter).
Folder Structure Example: /grpc/grpc_server.rb (I want to call the class from here) /app/models/my_model (I want to call this class)
In grpc_server.rb require_relative
the rb file containing the store_this_thing_to_the_db
function and call.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.