- This topic has 2 replies, 2 voices, and was last updated 4 years, 5 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Hi Kim
kbmMW allows me to do async queries and async service requests. Return results of all async requests are processed in kbmMWTCPIPIndyMessagingClientTransport1AsyncResponse event.
It’s easy if I have one form and one query/service. My problem is multiple forms and multiple queries/service-requests in each form.
Is there an easy technique to figure out in AsyncResponse event who it the caller (which form, which query component)?
One of the things I want to do (among others) is to enable activity indicator and disable some buttons before the call to query/service and reset it upon return.
Ideally it would be a callback procedure that I pass to query/service call and upon return just execute it.
I think it would be beneficial to others too.
Thank you.
Regards
Zoran
Hello Everyone
Found the solution. It’s a simple TDictionary list of RequestIds and callback procedures. Upon return from query/service in kbmMWTCPIPIndyMessagingClientTransport1AsyncResponse event I check RequestId against this list and, if found, execute corresponding callback procedure.
If any of the fellow kbmMW-ers is interested I can send a complete demo source. I’m using D 10.3.3, FireDAC and Firebird 3.0.7.
Again, this is a simple solution to setup GUI before time consuming kbmMW operations, do some other work while it is running, and clean up GUI upon return. Maybe not elegant as it might be, but it does the job for me.
I’ve tried to do the same thing with
Scheduler.Run(
procedure
begin
…run query or service …
end)
.SynchronizedAfterRun(
procedure
begin
… process the resut …
Memo1.Lines.Add(res);
end)
.Activate(true);
but was successful only with queries, not with service calls. Perhaps I was doing something wrong.
Regards
Zoran
Hi,
A service call is a request for which no response is provided nor expected.
You could use kbmMW’s SmartEvent framework to distribute your events to your various code, which subscribes for various scenarios, like when a response has happened.
An advantage is that you do not need to hardlink between forms and message handling.
Check the blog for kbmMW SmartEvent.
/Kim