[Discuss] Use gRPC gateway to generate REST endpoints
Nessuno ha ancora preso questa issue.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Introduction
Right now, feast-java uses RestController (example code) to implement REST endpoints for both feast-core and feast-serving. However, this approach will increase maintenance cost. Therefore, generating REST endpoint from proto definitions is a cleaner way.
Proposed Change
Use grpc-gateway to generate the REST endpoint.
Steps
1. Add gateway server to translate REST call into gRPC call to another process inside the container
The example gateway server will look like:
package main
import (
"context"
"flag"
"fmt"
"net/http"
"github.com/golang/glog"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
coreGateWay "pkg/gateway/generated/feast/core"
servingGateWay "pkg/gateway/generated/feast/serving"
)
// gRPC serving endpoint
var servingServerEndpoint = flag.String("serving-server-endpoint", "localhost:6566", "gRPC server endpoint")
func run() error {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
mux := runtime.NewServeMux()
opts := []grpc.DialOption{grpc.WithInsecure()}
// Register ServingServing endpoint
err = servingGateWay.RegisterServingServiceHandlerFromEndpoint(ctx, mux, *servingServerEndpoint, opts)
if err != nil {
return err
}
// Start HTTP server (and proxy calls to gRPC server endpoint)
return http.ListenAndServe(":8000", mux)
}
func main() {
flag.Parse()
defer glog.Flush()
if err := run(); err != nil {
fmt.Println(err)
glog.Fatal(err)
}
}
2. Use supervisord to start two processes inside a container
We can provide instructions to use different entry points. Here's an example config:
[supervisord]
nodaemon=true
[program:serving]
directory=/
user=root
command=java -jar /opt/feast/feast-serving.jar --spring.config.location=classpath:/application.yml,file:/etc/feast/%(ENV_FEAST_SERVING_YML_NAME)s
[program:gateway]
directory=/
user=root
command=/opt/feast/gateway_server
--serving-server-endpoint=%(ENV_FEAST_SERVING_URL)s
numprocs=1
3. Remove existing REST controllers' code
As titled.
- Lingua principale
- Java
- Stelle
- 12
- Fork
- 26
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di feast-dev/feast-java-old
-
[Discuss] Support different stores for different projects in one single feast-serving container Aperta
feast-dev/feast-java-old#30 · 2 commenti · 1 assegnatario ·
-
[Discuss] Feast Enhancements Apertaquestion
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
feast-dev/feast-java-old#6 · 5 commenti · 1 reazione ·
Tutte le issue di feast-dev/feast-java-old
Issue simili
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/rocketmq-dashboard#5064 ·
-
Consent portal: creating a duplicate Purpose shows a generic error instead of "already exists" Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
wso2/dpdp-accelerator#287 ·