aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

Using aqueduct with gRPC [enhancement]

Open listepo-alterpost opened this issue 8 years ago • 12 comments

Looking for using Aqueduct with gRPC will be more awesome! grpc-dart

listepo-alterpost avatar Apr 15 '18 21:04 listepo-alterpost

+1

i got grpc working with flutter. it saves alot of work and is fast. would be awesome with aqueduct behind it

ghost avatar Apr 26 '18 21:04 ghost

What all does this entail?

itsjoeconway avatar Apr 26 '18 22:04 itsjoeconway

Grpc is just codegen with protoc. Heaps of examples. You can do bi-directional streaming.

Then just have aqueduct under the dart server generated code.

You will get much higher perf and you client and server code stays in sync

ghost avatar Apr 29 '18 20:04 ghost

+1

@joeconwaystk, we would like to see this officially supported in aqueduct. Is this enhancement planned for any upcoming aqueduct release?

mohanavijay avatar Jul 11 '19 04:07 mohanavijay

Not currently planned. I don't know much about gRPC, nor how it would be surfaced as a feature of Aqueduct. If someone is able to help plan what they'd like an interface/toolchain to look like, I'd be happy to look at how it'd be implemented and put together a timeline.

itsjoeconway avatar Jul 11 '19 15:07 itsjoeconway

I am slowly working to have gPRC with Aqueduct, but to get it working I got a channel with grpc server instance on startup, that alone is single socket server and it limits on how many such channels can be created. Also Aqueduct supports single Channel - I bet for same reason. My gRPC service takes context for ORM and auth server (which integration I didn't finalized with gRPC auth)

maybe I create sample opensource project as battle test so I can share it

magillus avatar Jul 11 '19 23:07 magillus

Looking forward to it!!! Thank you!

diegopego avatar Nov 14 '19 14:11 diegopego

This seems like a neat idea but non trivial!

gRPC generates dart entities along with client and server stubs (including json serialization)- but those entities are not compatible with Aqueduct's ORM. You need a way to efficiently syncronize state between Aqueduct ORM classes and gRPC generated one - ideally with some kind of code generation so you don't need to write a bunch of redundant code.

I suppose one could use json serialization -but that largely defeats the performance benefit of using gRPC.

wstrange avatar Jan 20 '20 17:01 wstrange

Thats assuming you want to use gRPC with your ORM which is not the case, you probably just want that as a contract between your endpoints as thats what its for. To replace the DTO layer.

I'm doing the opposite right now where I use Aqueduct for the ORM only, and then use dart server to host gRPC endpoints in Kube :)

SKLn-Rad avatar Feb 19 '20 21:02 SKLn-Rad

@SKLn-Rad Interesting - can you elaborate on this architecture? Are you accepting gRPC requests in your Aqueduct process, then going straight to the ORM? (i.e. basically bypassing the Controller logic in Aquaduct?). Or something else?

wstrange avatar Feb 19 '20 22:02 wstrange

Exactly. I have aqueduct bootstrapped in microservices which need access to their own schema but literally just use it as an ORM. Aside from that I am using grpc as seen in the examples to run a server. Difficult part was actually get things like tracing to work as their isnt a good solution yet for it.

SKLn-Rad avatar Feb 19 '20 23:02 SKLn-Rad

no news about gRPC and aqueduct?

ghost avatar Aug 16 '20 14:08 ghost