Hi all,
I have a B4J Server application implementing a REST API service with multiple Handler Class Modules.
In one of these class modules I need to use CallSubDelayed to raise a callback event which is used in a Wait For in a different class module.
Is this possible?
If so, how do I reference in CallSubDelayed the class module I want to call?
What should I use in lieu of the XXXX placeholder below?
Is there a better way to implement an asynchronous callback?
Many thanks in advance!
I have a B4J Server application implementing a REST API service with multiple Handler Class Modules.
In one of these class modules I need to use CallSubDelayed to raise a callback event which is used in a Wait For in a different class module.
Is this possible?
If so, how do I reference in CallSubDelayed the class module I want to call?
What should I use in lieu of the XXXX placeholder below?
Is there a better way to implement an asynchronous callback?
Many thanks in advance!
B4X:
'Handler Class module GetResponse
Sub Handle(req As ServletRequest, resp As ServletResponse)
' ...
'Skipped some code that makes an HTTP call to an external service
' ...
Wait For Callback_Done
' ...
'Skipped some code that reads the data from the DB
' ...
End Sub
'Handler Class module Callback
Sub Handle(req As ServletRequest, resp As ServletResponse)
' ...
'Skipped some code that reads JSON data from a callback and writes into a DB
' ...
resp.Status = 200
resp.Write("")
CallSubDelayed(XXXX, "Callback_Done")
End Sub