tower-grpc icon indicating copy to clipboard operation
tower-grpc copied to clipboard

Examples using tower-grpc with middleware

Open jakobdalsgaard opened this issue 7 years ago • 4 comments

I was just wondering if anyone has an example of a running tower-grpc server that uses some of the tower middleware? I know that we currently do not have the chaining logic of tower-web; but some kind of chaining should be possible, right?

(Been trying for a while ... keep failing at stuff not Cloneable or not the proper kind of Service :/ )

jakobdalsgaard avatar Oct 07 '18 18:10 jakobdalsgaard

I forked tower-grpc to try out a few ideas; I now have middleware support (a naive implementation...) for server side code generation here: https://github.com/jakobdalsgaard/tower-grpc -- I'll make an example too -- just need time.

The implementation merely wraps Service response types with middleware, and does nested constructor calls on service instantiation; doesn't seem perfect, but for now it works :-)

jakobdalsgaard avatar Oct 20 '18 12:10 jakobdalsgaard

need middleware +1

micfan avatar Jun 16 '19 12:06 micfan

Here is an example of a tower middlware being applied to a grpc client. https://github.com/tower-rs/tower-grpc/blob/master/tower-grpc-examples/src/helloworld/client.rs#L29

LucioFranco avatar Jun 17 '19 15:06 LucioFranco

@LucioFranco Thank you, I'll check that example

update: I mean that is there some kind of server side middleware register, like https://github.com/jakobdalsgaard/tower-grpc/commit/74476dedc2f51167c0962acc2a06ed954eaa5e02 implemented

micfan avatar Jun 17 '19 17:06 micfan