Hello There ,
I was going through Server Code Functionality before implementing them in my Backendless App. I needed to override ‘AfterFind’ Functionality . Is the Afterfind Functionality Asynchronous or not ? Suppose , I need to Update rows of result returned from this callback. (By Update I mean that The Fresh data needn’t be supplied to the Client who has requested the data )
ExecutionResult<BackendlessCollection>
result
The result Object has some property which I need to update after Delivering the result Data to the Client Requested(From the Server Side ) . Can I Do the Operation asynchronously while Delivering the data to the Client ( in the After Find Call Back ) or I have to wait for my Custom Operation to be Finished to send the data back to the Client ?
Any sorts of help on this would be very helpful
Hi Pujan,
The “before” and “after” events can be either synchronous or asynchronous depending on how you declared them in your code. In Java, you use the @Async annotation to make the handler asynchronous. When you do that, Backendless will ignore the result of the event handler and will deliver the result of the default service implementation. In case of synchronous handler, you can modify the response and that’s what will be delivered to the client.
Hope this helps.
Mark
Hello Mark ,
Okay I understood the @Async annotation part
I want to know how the system flow actually works : How I have Imagined
- Before Find is executed
2)Finding the results take place
- After Find is executed
Here, while at Step 3 . I want to perform an operation . Do I have to wait till the operation is complete so that the Result data is actually delivered to the Client or , the Result delivery part to the Client : and the Server task that takes some time( let us suppose 5s ) can be done simultaneously , or say Asynchronoulsy .
I hope you understood my query .
Regards,
Pujan
Pujan,
I apologize, but I didn’t understand what you wrote. Perhaps the following will help:
- Before Find is executed
2)Finding the results take place. Result of this operation is sent to the AfterFind
- After Find is executed. INSIDE of your AfterFind event you can modify the result from the previous step. The modified result will be returned to the client.
Mark