How to track status of an async long running process from stateless spring boot services in GCP?

9/16/2018

We have a few Spring Boot services running in a GCP Kubernetes Engine which expose their HTTP(over gRpc) API to the clients. One task is to import very large data files. The proposed way is to upload files to Google storage and trigger an asynchronous import by providing the file-path to the import location and return HTTP 202 in case the request was valid.

Next, we set the status of the import to pending within the persistence layer (spanner) and trigger an asynchronous parsing and batch ingestion process. In case the import was successful we set the status to completed. The only way for a client to know if the import was successful is to come back and poll our API for the current status.

And there arises the question then. There are several load-balanced pods of the same kind. If the importing service crashes (i mean crash, not exception handling), there is no straightforward way for us to finally set the status to aborted. The status will remain pending forever.

We would like to circumvent the use of an additional layer like hazelcast if possible. Also, we`d like to avoid having another service that communicates with one or other pods directly, observes the states and does some fancy callback stuff.

Can anyone give a hint of how to tackle that problem in a best practice manner?

Many thanks.

-- HannesB
asynchronous
google-kubernetes-engine
spring-cloud-gcp

0 Answers