fission
fission copied to clipboard
Asynchronous Function Calls
We have a usecase where we need to run some long running code as part of the fission functions.
But we do not want client to keep hanging on the reply. We need to send HTTP-200 immediately and actually convey the output of the function to the caller asynchronously
Similar feature is available in OpenFaaS: https://docs.openfaas.com/reference/async/
Actually, you can achieve this now.
Let say you can write two functions A and B. Function A receives a request, which contains callback URL in request body, from the router then publish a message to the internal NATS-Streaming server. Create a mqtrigger with function B that subscribe to the topic and do some work, then reply result with callback URL.
I think what OpenFaaS does is to simplify these steps for users. But I'm fine to have this feature since it does reduce some effort for users.
@soamvasani @vishal-biyani any thoughts?
@life1347 Since this is a useful feature and enables a whole bunch of new use cases, I am in favor of making this a feature that is built-in Fission!
Hi.
Has this feature made much progress? I'm currently evaluating several solutions, am leaning to Fission but would like to understand timelines on this feature.
Hi @gkainth We don't have any specific progress on this yet but this is easily doable:
- A primary function that accepts the message and responds with an ID.
- The function places the request in a queue.
- Another function is invoked by queue - which runs for a longer duration
- After execution of the function, the response is kept in a response queue
- The primary function now if requested for status if that job shows as finished status. Similar logic for error too.
Hi Vishal, Can we expect this feature to be released with v1.16.0? The alternate idea is good and will work, but we prefer this as an OOB feature.
Just noting down link to old proposal: https://github.com/fission/fission/blob/async-requests/Documentation/wip/async-requests.md