hi everyone :wave: :grinning:, I’m a completely ne...
# http4k
x
hi everyone 👋 😀, I’m a completely newbie to gRPC. I have using HTTP4K for a few years now and I love its testability. I have just introduced HTTP4K to the place where I started working recently. gRPC is used extensively at this new place and I will need to make gRPC calls inside my HTTP4K application. I’m wondering what people’s experience are like to use gRPC inside a HTTP4K application? Any tips/advice? I’m thinking to adapt the underlying gRPC request & response to the
HTTPHandler
interface which can make testing easier (it is just an idea atm, not sure if this even makes sense). Do people have any other tips? Like what do you use for testing? Anything nice you use for recording and replying requests and responses? Thank you 🙏
d
We have successfully implemented GRPC with http4k before. At their heart,GRPC calls themselves are fundamentally just HTTP POSTs to the root with a query parameter determining the method you are calling. You just need the serialiser/deserialisers to be plugged in as lenses and you're away.
We used Protokruft at the time to provide a Kotlin DSL over the top of the awful GRPC Java builders - but GRPC now supports Kotlin so you may not need it
For record/replay, I'd personally just convert the messages to JSON.
As you say - the testability is pretty bad - http4k made this much better than native GRPC though.
As for deployments - if you're in K8S then beware of HTTP connections being kept awake. This means you might get stickiness with your clients where all of the traffic ends up going to a single pod. A sidecar loadbalancer can be a way out of this problem.
x
This is so helpful @dave Thank you so much!