NOTIFY/LISTEN in Postgresql
NOTIFY/LISTEN in Postgresql
Hi there
How can I use the NOTIFY/LISTEN interprocess communication mechanism in postgresql?
See http://www.postgresql.org/docs/9.1/stat ... otify.html
Thanks & cheers,
Peter
How can I use the NOTIFY/LISTEN interprocess communication mechanism in postgresql?
See http://www.postgresql.org/docs/9.1/stat ... otify.html
Thanks & cheers,
Peter
Re: NOTIFY/LISTEN in Postgresql
Hi
It is very easy. There is a special component for this - TPgAlerter.
With the help of its methods/properties/events the PostgreSQL NOTIFY/LISTEN gear is realized.
So, for example, a notification is sent by the procedure SendEvent(const MessageName: string; MessageText: string);
You can find more details in the context help of the TPgAlerter component.
Also, if you have bought PgDAC, you must have demo projects:
...\Demos\Win32\PgDacDemo\PgDacDemo.dpr
where you can see Alerter in action, watching the sources in parallel
It is very easy. There is a special component for this - TPgAlerter.
With the help of its methods/properties/events the PostgreSQL NOTIFY/LISTEN gear is realized.
So, for example, a notification is sent by the procedure SendEvent(const MessageName: string; MessageText: string);
You can find more details in the context help of the TPgAlerter component.
Also, if you have bought PgDAC, you must have demo projects:
...\Demos\Win32\PgDacDemo\PgDacDemo.dpr
where you can see Alerter in action, watching the sources in parallel
Re: NOTIFY/LISTEN in Postgresql
Thanks for the info!
Just for your Information.
-> In my Lazarus/Ubuntu IDE the component "TPgAlerter" is not shown on the component bar/panel (all the other components are well there!).
Thanks & cheers,
P.
Just for your Information.
-> In my Lazarus/Ubuntu IDE the component "TPgAlerter" is not shown on the component bar/panel (all the other components are well there!).
Thanks & cheers,
P.
Re: NOTIFY/LISTEN in Postgresql
Hi there
I am unable to manually free the PgAlerter component in Lazarus/Ubuntu. The same code works fine under Delphi7. Here's my code:
Thanks & cheers,
Peter
I am unable to manually free the PgAlerter component in Lazarus/Ubuntu. The same code works fine under Delphi7. Here's my code:
Code: Select all
unit AlerterEventsLib;
interface
uses
Classes, SysUtils, DAAlerter, PgAlerter, DB, DBAccess, PgAccess;
type
TAlerterEvents = class
private
PgConnection: TPgConnection;
PgAlerter: TPgAlerter;
procedure AlerterEvent(Sender: TObject; const EventName: AnsiString; PID: LongInt; const EventMessage: AnsiString);
public
constructor Create(const Channel: AnsiString);
destructor Destroy;
end;
implementation
uses
Globals;
procedure TAlerterEvents.AlerterEvent(Sender: TObject; const EventName: AnsiString; PID: LongInt; const EventMessage: AnsiString);
begin
WriteLn('Received Event:' + EventName);
end;
constructor TAlerterEvents.Create(const Channel: AnsiString);
begin
PgConnection := TPgConnection.Create(nil);
with PgConnection do begin
Server := ConfigRecord.DatabaseServerIp;
Port := ConfigRecord.DatabaseServerPort;
Database := ConfigRecord.DatabaseName;
Schema := ConfigRecord.DatabaseShema;
Username := ConfigRecord.DatabaseUser;
Password := ConfigRecord.DatabasePassword;
end;
try
PgConnection.Connected := True;
PgAlerter := TPgAlerter.Create(nil);
PgAlerter.OnEvent := @AlerterEvent;
with PgAlerter do begin
AutoRegister := False;
Connection := PgConnection;
Events := Channel;
Active := True;
end;
except
WriteLn('Error Creating PgAlerter');
end;
end;
destructor TAlerterEvents.Destroy;
begin
WriteLn('Start Destroy PgAlerter');
PgAlerter.Active := False;
PgAlerter.Free;
WriteLn('Done'); //<<<<< NEVER COMES UNTIL HERE
WriteLn('Start Destroy PgConnection');
PgConnection.Connected := False;
PgConnection.Free;
WriteLn('Done');
end;
end.
Peter
Re: NOTIFY/LISTEN in Postgresql
Hi
That's right, there is no such component for Linux.
We will check the workability of your code.
That's right, there is no such component for Linux.
We will check the workability of your code.
Re: NOTIFY/LISTEN in Postgresql
Hi there
Any news on this?
Thanks & cheers,
P.
Any news on this?
Thanks & cheers,
P.
Re: NOTIFY/LISTEN in Postgresql
hello,
Presently, TPgAlerter works only on Windows platform, we will try to support PgAlerter in Unix platforms in the next versions
Presently, TPgAlerter works only on Windows platform, we will try to support PgAlerter in Unix platforms in the next versions
Re: NOTIFY/LISTEN in Postgresql
Hi there
Thx for the answer.
I am actually already using TPgAlerter quiet extensively in my Linux/FPC application (development stage). It seems to work just fine so far except that I can not free it correctly.
It would be a shame if I had to change my code again -> Can you give me a approximate date for the next release? If this is not too far I might be able to wait...
Thanks & cheers,
Peter
Thx for the answer.
I am actually already using TPgAlerter quiet extensively in my Linux/FPC application (development stage). It seems to work just fine so far except that I can not free it correctly.
It would be a shame if I had to change my code again -> Can you give me a approximate date for the next release? If this is not too far I might be able to wait...
Thanks & cheers,
Peter
Re: NOTIFY/LISTEN in Postgresql
hello,
The new release of our products with support of the new two features, Data Encryption and Data Type Mapping, has just come out. Therefore the next release is expected not earlier then in a month
The new release of our products with support of the new two features, Data Encryption and Data Type Mapping, has just come out. Therefore the next release is expected not earlier then in a month
Re: NOTIFY/LISTEN in Postgresql
Hi there
Is there any news on this resp. availability of the PgAlerter component for Lazarus/Ubuntu?
Thanks & cheers,
P.
Is there any news on this resp. availability of the PgAlerter component for Lazarus/Ubuntu?
Thanks & cheers,
P.
Re: NOTIFY/LISTEN in Postgresql
hello,
We are still working on this problem.
We will notify you as soon as we have any results.
We are still working on this problem.
We will notify you as soon as we have any results.
Re: NOTIFY/LISTEN in Postgresql
Hi there
Is there any workaround available yet?
I am stuck with this issue for 3 months now! I need a working TPgAlerter for Linux.
Thanks & cheers,
P.
Is there any workaround available yet?
I am stuck with this issue for 3 months now! I need a working TPgAlerter for Linux.
Thanks & cheers,
P.
Re: NOTIFY/LISTEN in Postgresql
Hi there
Can I assume that no answer = Good answer?
Comon guys you must be able to give some kind of timeline here! I am a paying customer and I am not requesting a new feature. All I expect is that an existing feature gets fixed (Since 4th of June actually)!
Thx & cheers,
Peter
Can I assume that no answer = Good answer?
Comon guys you must be able to give some kind of timeline here! I am a paying customer and I am not requesting a new feature. All I expect is that an existing feature gets fixed (Since 4th of June actually)!
Thx & cheers,
Peter
Re: NOTIFY/LISTEN in Postgresql
The working TPgAlerter component for Linux is the new feature of PgDAC, not just a fix of an existing feature.
TPgAlerter was never supported on Linux, because it widely uses such specific Windows mechanisms as messages and critical sections, the implementation of which in FPC is not good enough.
At the moment we are trying to adapt the TPgAleter component for Linux, and we will notify you when we have any results.
TPgAlerter was never supported on Linux, because it widely uses such specific Windows mechanisms as messages and critical sections, the implementation of which in FPC is not good enough.
At the moment we are trying to adapt the TPgAleter component for Linux, and we will notify you when we have any results.
Re: NOTIFY/LISTEN in Postgresql
We have adapted TPgAlerter for Linux. This component will be included in the next PgDAC build.