Async Connector Requests inside a serverside Business Object
# 3 weeks ago
I’m looking for a way to do async connector requests inside a serverside BO.
I have a use case where I have to process a row of time consuming connector requests combined with a CryptoJS data decryption. I thought it would be best to wrap this in a single BO-Call instead of doing multiple request from the client, which will cause more overhead and will eventually instability problems.
But theres no async Connector API nor a JS language support for doing this.
Is there a hidden utility api to make those connector calls async and wait for them all to finish before returning the result of the BO? Or do I really have to solve this client side?
Thank you for your help.
- This topic was modified 3 weeks ago by C.Steinbach.
# 3 weeks ago
- Topics: 0
- Replies: 3
maybe i got your use case wrong so please correct me if necessary.
You want to trigger a few connector calls and use the result of each of those to combine it and afterwards use CryptoJS.
When all this is done the result should be returned to your client application.
You can use a server side business object to achieve this. Implement the needed connector calls inside the business object by using the Business Object API and save the results into variables, combine everything and add your CryptoJS logic.
The call of the server side business object from the client is asynchronous, the logic inside the business object is synchronous.
The BO will return the result only after every connector call is finished and the rest of the logic is executed.
Hope that helps you
as you said, the logic inside a business object is synchronous only.
In my example I want to load 10 or more encrypted files via REST-Connector call and decrypt each file as they arrive. In a synchronous world this is very time consuming by doing this one by one.
My first idea to solve this was to use JS-Promises. But the ES5 doesn’t support JS-Promises. Then I thought there might be an alternative Connector Call to get a promise instead the result. Like certain JQuery-based Libs does in good old ES5 times. But this would not work either because this would require to have some kind of callback function to resolve the BO-Call itself after all promises are resolved.
It seems that have to solve this client side.ArminModerator
Has successfully completed the online course No-Code.Has successfully completed the online course Low-Code.Has successfully completed the online course Pro-Code.
- Topics: 0
- Replies: 42
You must be logged in to reply to this topic.