Open armanbilge opened 2 years ago
While CloudEvents handler support may take some effort since we need to have some sort of CloudEvents SDK for Scala, supporting HTTP would be the first step? ref: https://github.com/typelevel/feral/issues/268
supporting HTTP would be the first step
@tanishiking I think we already support HTTP. As far as I can tell there is nothing special about it, it is just ordinary HTTP. So you can make an HTTP application with http4s Ember server and deploy it to Google Cloud Run.
@armanbilge Great, thanks! I gonna play around with GCP stuffs with Scala Native when I have time, since most of GCP APIs are well defined with gRPC (or OpenAPI) https://github.com/googleapis/googleapis.github.io/ and I remember you mentioned there exists pure Scala gRPC client davenverse/http4s-grpc on Discord 👍
https://discord.com/channels/632150470000902164/635668881951686686/1152248482992762932
Oh, it's already generated https://davenverse.github.io/googleapis-http4s/ 😃
https://github.com/GoogleCloudPlatform/functions-framework#functions-framework-contract
This is lower-level than Cloud Functions, which enables us to implement concurrency, and thus achieve better efficiency than non-concurrent serverless options like Lambda.
Note that these frameworks are containerized and deployed to e.g. Cloud Run. This is different from FaaS, where you typically upload an npm package or a jar.
These tips for running Java in Cloud Run (and only Java!) suggest that Node.js is still an ideal runtime even for the framework setup: https://cloud.google.com/run/docs/tips/java
There's also a testkit: https://github.com/GoogleCloudPlatform/functions-framework-conformance
Finally, none of this is specific to Google Cloud per se: it works with ordinary HTTP events and platform-agnostic CloudEvents and is deployable to kubernetes/knative ... although, not sure how widely adopted these are outside of Google (AWS does not support CloudEvents, https://github.com/cloudevents/spec/issues/435).
This also makes testing locally much easier, since it does not rely on emulators of serverless environments.