Hello,
I've noticed that posted events get cleared whenever I add a new event to TIBCAlerter. Although this can be solved by calling Application.ProcessMessages before Events.Add, I would prefer a better solution. I'm using version 7.2.4.
During application initialization a few events get registered at different times in a single long-running method. If Firebird posts any events before the last event is registered, TIBCAlerter never fires.
Any help would be appreciated.
Thanks!
TIBCAlerter clears posted events when calling Events.Add
Re: TIBCAlerter clears posted events when calling Events.Add
Hello,
In order to get a detailed answer, please compose a small sample demonstrating the specified behavior and send it to us including scripts for creating and filling database objects.
wbr, Oleg
Devart Team
In order to get a detailed answer, please compose a small sample demonstrating the specified behavior and send it to us including scripts for creating and filling database objects.
wbr, Oleg
Devart Team
Re: TIBCAlerter clears posted events when calling Events.Add
Memo1 contains only "event2" unless ProcessMessages gets uncommented.
Code: Select all
procedure TForm1.FormShow(Sender: TObject);
begin
IBCAlerter1.Events.Add('event1');
IBCAlerter1.Start;
IBCAlerter1.SendEvent('event1');
//Application.ProcessMessages;
IBCAlerter1.Events.Add('event2');
IBCAlerter1.Start;
IBCAlerter1.SendEvent('event2');
end;
procedure TForm1.IBCAlerter1Event(Sender: TObject; EventName: string;
EventCount: Integer);
begin
Memo1.Lines.Add(EventName);
end;
Re: TIBCAlerter clears posted events when calling Events.Add
Hello,
When a new event is triggered, Alerter stops. Therefore, it doesn't manage to handle the first event. Invoking Application.ProcessMessages doesn't help in this case. In a real world application, the server probably won't manage to send the message while Application.ProcessMessages is being invoked.
The basic solution here is to run Alerter after all events have been registered or wait for the first event and only then add the second event, if all events are known in advance.
wbr, Oleg
Devart Team
When a new event is triggered, Alerter stops. Therefore, it doesn't manage to handle the first event. Invoking Application.ProcessMessages doesn't help in this case. In a real world application, the server probably won't manage to send the message while Application.ProcessMessages is being invoked.
The basic solution here is to run Alerter after all events have been registered or wait for the first event and only then add the second event, if all events are known in advance.
wbr, Oleg
Devart Team
Re: TIBCAlerter clears posted events when calling Events.Add
Thanks for your help. I've solved the issue by creating a separate Alerter when registering a new batch of events.