cloudstate
cloudstate copied to clipboard
Projection support
TODO devise a solution for being able to consume domain events to facilitate things like creating projections, or even consuming domain events from something like Alpakka (CloudEvents?)
@viktorklang, can we sync on that to avoid having different APIs? Unless this is something that needs to be completely different because of its nature.
But in any case, ultimately, it would be better if the underlying used API (not the one exposed to the client) is based on what we plan to build for general projections in Akka/Play/Lagom.
@renatocaval This Issue is not about creating a new API, it's more to establish the flow to what they will create their projections from/using. Initially we're likely to either use the Akka Persistence projections or create an ingress for Pipelines.
I got it. Thanks for the explanation.
You’re most welcome! 🙂
Cheers, √
So, this has turned out to be a bit of a yak shave. There's a lot of things to solve. My progress is here:
https://github.com/jroper/cloudstate/tree/eventing
I haven't even started on projection support, just getting things ready. Here's what I've implemented:
- Modified it so the event source isn't a
Source
, it takes aFlow
and is responsible for running it. - Made acknowledgements so they execute after the handler has returned (previously, they were executed in parallel to the handler handling the event, meaning event processing was at most once). This is why the
Source
takes aFlow
, the output of theFlow
is the acknowledgement message references. - Made the Google Pubsub support use the streaming call properly - we send one subscription call, send the messages in the pull response through the handler, and then route the acknowledgements back into the input of the call (a circular graph), rather than making separate gRPC calls for it.
- Added a RestartSource so that when there's a network/io failure/application error etc, the stream restarts.
- Implemented support for more than just serialized Anys on the wire. We now support JSON, plain text, plain bytes, and protobufs (not wrapped in Any). We use Cloudevents metadata to pass type information.
- Added support for Cloudevents. This metadata is not yet sent to/from the user functions, but it will be.
I'm now pretty close to actually implementing the projection support.
Nice @jroper !
Hi ... Any new progress on this? I was wondering if it's possible to consume Kafka events and react to them using CloudState.
@omidb Reacting to Kafka events seems more like a Eventing-related question. You can implement support for Kafka and plug that into the Eventing Support (currently on Google Cloud PubSub support is built in).
@viktorklang Would you please point me to the docs for Eventing Support?
@omidb It has not been officially released yet, but you can see it here:
https://github.com/cloudstateio/cloudstate/blob/master/proxy/core/src/main/resources/reference.conf#L76
And how it can be used here: https://github.com/cloudstateio/cloudstate/blob/master/protocols/example/shoppingcart/shoppingcart.proto#L47
Current status video by @jroper - https://youtu.be/lan5Awqy-xI