eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders

How to notify the front-end on Saga Completion with WebSockets

BenNeighbour opened this issue · 3 comments

Hi @cer @dartartem and everybody else, I have currently finished all of my server-side work. Now I am using GRPC from the services to the frontend. This works fine, however the response is received before the saga has actually completed/failed.

One way of fixing this is having the frontend poll the server side on some endpoint and it return the primary Entity that has been saved by that saga. However, this seems overkill and isn't very good in my opinion.

So then I decided to use GRPC. My problem with GRPC on the server end is that I cannot send a message back to the client from another class (ie. The Class that has the Eventuate Saga Definitions). I saw that there is a method called onSagaCompletedSuccessfully or the onSagaRolledBack - which is great - nice work, I like that. However, I cannot do a responseObserver.onNext(response) from there as it's outside the GRPC implementation class.

I appreciate that this doesn't really have anything to do with the Eventuate Framework itself, however I thought that @cer wrote a book on this at some point - was wondering if him or anybody had a solution to this. Sorry if this is a vague question but I'd massively appreciate any help/pointers. Hopefully you understand what I mean.

Hi @cer @eventuateio @dartartem and everyone else, I am thinking about moving away from gRPC (for frontend-backend calls). This is because of the issues outlined above. I understand that I can use Apache Kafka as the message broker with Spring Websockets and SockJS (with React). This is all fine, but I am using a Kafka Cluster with Eventuate (which does all of the config for me). Will I still be able to use Kafka like normal without having to add that dependency or is that already done by the eventuate Gradle Dependencies?

Hi @BenNeighbour, I am not sure what do you mean. Eventuate kafka modules contain kafka client as dependency. So, if you use some eventuate kafka-related module in your project, you will be able to use kafka api directly without explicitly specifying kafka client dependency.

Ah right, that's what I was asking. Thanks for the reply @dartartem