salesforce / reactive-grpc

Reactive stubs for gRPC
BSD 3-Clause "New" or "Revised" License
829 stars 118 forks source link

Possible to have non-publisher for RPC method parameter? #295

Closed deepak-auto closed 1 year ago

deepak-auto commented 2 years ago

Using the example in the README, can we have this method signature

ReactorGreeterGrpc.GreeterImplBase svc = new ReactorGreeterGrpc.GreeterImplBase() {
    @Override
    public Mono<HelloResponse> sayHello(HelloRequest request) {
        return greet("Hello", request);
    }
};

instead of

ReactorGreeterGrpc.GreeterImplBase svc = new ReactorGreeterGrpc.GreeterImplBase() {
    @Override
    public Mono<HelloResponse> sayHello(Mono<HelloRequest> request) {
        return request.map(protoRequest -> greet("Hello", protoRequest));
    }
};

?

This way, we can access the request object from anywhere in the method. It will prevent us from writing an extra map function as in the example above.

bsideup commented 1 year ago

Duplicate of https://github.com/salesforce/reactive-grpc/issues/78 (shouldn't be closed, btw :))

bsideup commented 1 year ago

Have submitted https://github.com/salesforce/reactive-grpc/pull/301 (better later then never, huh? 😄)