Page 1 of 1

Alert/notify

Posted: Tue 25 Apr 2017 17:16
by spliter
Hi, i have few more questions about alerts
1. i really dont understand this https://www.devart.com/dotconnect/postg ... on_EV.html between pgalert. Starting i thought this is another way to get notify messages, and there is possibility to get ProcessID, because i cant find in PgAlerter, but it didnt worked for me.

2. Does alerter works in other threads? My program posts data and send notify. My PgAlerter is on new connection but in same program. So basically, program posts data and also recive, that data changed.
a) in Delphi i can get connectionID and verify, that executed by itself, so i can skip double refresh
b) one data refresh didnt finished, when alerter executed new one, so program just crashed. Is it possible, that alerter is on different thread? I cant find any information in your help about it.

Re: Alert/notify

Posted: Tue 25 Apr 2017 17:22
by spliter
I dont know is that right way, but it working. I hope on your comments about it.

Code: Select all

private void ZPgEventAlerter_Alert(object sender, PgSqlAlerterAlertEventArgs e)
        {
            if (Program.MainFormInstance.InvokeRequired) 
            {
                //if MainDM.DBConnectionPID <> ProcessID  then
                if (e.AlertName == "shift_update")
                    Program.MainFormInstance.Invoke(new Action(() => RefreshActiveShift())); 
                else if (e.AlertName == "shift_pile_update")
                    Program.MainFormInstance.Invoke(new Action(() => RefreshActivePile()));
            }
            else
            {
                if (e.AlertName == "shift_update")
                    RefreshActiveShift();
                else if (e.AlertName == "shift_pile_update")
                    RefreshActivePile();
            }

        }

Re: Alert/notify

Posted: Fri 28 Apr 2017 12:52
by Pinturiccio
spliter wrote:1. i really dont understand this https://www.devart.com/dotconnect/postg ... on_EV.html between pgalert. Starting i thought this is another way to get notify messages, and there is possibility to get ProcessID, because i cant find in PgAlerter, but it didnt worked for me.
At the moment we don’t pass ProcessId to PgSqlAlerterAlertEventArgs. We have added the ProcessId property to PgSqlAlerterAlertEventArgs. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.
spliter wrote:Is it possible, that alerter is on different thread?
PgSqlAlerter works in a separate thread.
spliter wrote:I dont know is that right way, but it working. I hope on your comments about it.
The code looks valid, but without knowing the purpose of the code, it’s hard to comment it.

Re: Alert/notify

Posted: Thu 04 May 2017 12:02
by Pinturiccio
We have added the ProcessId property to the PgSqlAlerterAlertEventArgs class. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

Re: Alert/notify

Posted: Fri 26 May 2017 09:55
by Pinturiccio
New version of dotConnect for PostgreSQL 7.9 is released!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Customer Portal (for users with valid subscription only).
For more information, please refer to viewtopic.php?t=35438