Alert/notify

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
spliter
Posts: 6
Joined: Sun 16 Apr 2017 10:10

Alert/notify

Post by spliter » Tue 25 Apr 2017 17:16

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.

spliter
Posts: 6
Joined: Sun 16 Apr 2017 10:10

Re: Alert/notify

Post by spliter » Tue 25 Apr 2017 17:22

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();
            }

        }

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Alert/notify

Post by Pinturiccio » Fri 28 Apr 2017 12:52

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.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Alert/notify

Post by Pinturiccio » Thu 04 May 2017 12:02

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.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Alert/notify

Post by Pinturiccio » Fri 26 May 2017 09:55

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

Post Reply