![]() |
Datenbank: PostgreSQL • Version: 9.3.8 • Zugriff über: PgDAC 4.7.25
TPgAlerter funktioniert nicht
Bei uns funktionieren seit Jahren öfters keine DB-Notifications und aktuell geht da fast garnichts.
Bisher hatten wir nur halbwegs "unkritische" Funktionen damit umgesetzt, weil es einfach nie sicher lief. Tja, "bisher" ... :stupid: Es hängt ein TPgAlerter an einer TPgConnection
Delphi-Quellcode:
Und zum Debuggen hängt aktuell auch noch ein Code an TPgConnection.OnNotification.
// im Create eines DataModuls
FUserNotifications := TPgAlerter.Create(Self); //FUserNotifications.Events := '_currentuser_'; FUserNotifications.Connection := FDatabase.Database; FUserNotifications.OnEvent := DBNotificationsEvent; FGlobalNotifications := TPgAlerter.Create(Self); FGlobalNotifications.Events := '_allusers_'; FGlobalNotifications.Connection := FDatabase.Database; FGlobalNotifications.OnEvent := DBNotificationsEvent; ... // im AfterConnect der PgConnection FUserNotifications.Events := AnsiLowerCase(FUsername); FUserNotifications.Active := True; FUserNotifications.AutoRestart := True; FUserNotifications.Start; FGlobalNotifications.Events := AnsiLowerCase('_allusers_'); FGlobalNotifications.Active := True; FGlobalNotifications.AutoRestart := True; FGlobalNotifications.Start; Im Programm oder aus Triggern/DBFunktionen wird dann pg_notify aufgerufen. Bisher war es so, dass es nur bei einem/zwei Kunden und dort auch nur manchmal in einer der Datenbanken für eine Weile nicht lief. Aktuell läuft auch bei uns im Developsystem garnichts, so dass ich endlich mal in Ruhe schauen konnte. Neustart der DB usw. half auch nix oder nur Kurz. Was ich jetzt raus fand, dass TPgAlerter und pg_notify nicht funktionieren. LISTEN und NOTIFY scheint "oftmals" noch zu funktionieren. ![]()
SQL-Code:
SELECT * FROM pg_listener
pg_listener hatte ich erst im WWW gefunden, aber seit 9.0 gibt es das nicht mehr. Von folgendem Code funktionieren (im Moment) nur die ersten 3 Befehle. Egal ob ich sie im Programm oder PgAdmin ausführe.
Code:
Unser Event im TPgAlerter würde auf diese Notification reagieren und eine MessageBox mit "Blubb" anzeigen, wenn sie mal drauf reagieren würde.
LISTEN fs;
LISTEN _allusers_; NOTIFY fs, 'Action=Message;Sender=fs;Type=Information;Text=Blubb'; SELECT pg_notify('fs', 'Action=Message;Sender=fs;Type=Information;Text=Blubb'); Leider kann man LISTEN/NOTIFIY nicht "direkt" current_user übergeben, darum wurde überall pg_notify eingebaut. Hat noch wer Probleme damit oder kennt 'ne Lösung? [edit 1] Grade bemerkt, dass NOTIFY und pg_notify im PgAdmin ankommen. In PgConnection.OnNotificaion kommt aber nur NOTIFY an und der TPgAlerter reagiert immernoch nicht. [edit 1.1] Kann aber auch daran liegen, das jetzt im Programm die Notifications wieder vollständig funktionieren. Kann also erstmal aufhören mit suchen/ausprobieren, da ich den Fehler nun nicht mehr nachstellen kann. :cry: [edit 2] Bei dem lief scheinbar pd_notify auch nicht. ![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz