Hi,
I wanted to know if there is some way of running a somewhat long task on backendless?
The scenario:
- Front end sends a request to kick-off a process
- Process starts and can take up to 30-40 seconds
- When it’s done, a message is published to a channel the frontend is subscribed to.
i can only think of hoping to trigger API calls on the backend this way:
- Request received → trigger API → get result and trigger the next API → get result and publish message.
Is there any way of possibly making a flow like this work?
Trying to minimize points of action on the frontend.
Thank You.
Hi @Innocent_Nwaukwa
I think it should be possible, and I don’t see a reason why it couldn’t be done. API Services give you quite a lot to work with here: custom events, the ability to run things asynchronously, the Messaging API and the Real Time API.
I don’t have an exact recipe to hand you, so it will take some experimenting. Your approach looks reasonable. Another option would be to launch an async custom event from your service and do the publish to messaging from the event itself.
Give it a try, and if it doesn’t come together, come back with what you’ve built and we’ll try to help.
Regards,
Viktor
1 Like
Oh, the critical thing I was more so requesting knowledge on was the frontend being able to essentially call an endpoint and just forget about it. A separate function on the frontend will be triggered when the message is published later.
So, the frontend could call an endpoint and get a quick success response while the backend does all the other tasks before publishing the message.
Otherwise, I’d publish a message from the frontend and subscribe to the channel on the backend but I was told that’s not feasible.
My primary road block is not knowing of a way to continue these operations without the frontend waiting for a response which would of course timeout because the API call is taking too long.
Is your frontend built with UI Builder or does it use Backendless JS SDK?
Uses the Backendless SDK.
Use the real-time messaging API to push data from the backend to your UI:
1 Like
Alright, I’ll give it a try.
Most of the time, I know what I can try but thank you as always for the assistance in better utilizing your platform 
Thanks,
Innocent.
1 Like