Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Who is LISTENing?

Received: by 10.180.91.231 with SMTP id ch7mr3642677wib.1.1350390692146;
        Tue, 16 Oct 2012 05:31:32 -0700 (PDT)
Path: q11ni134328605wiw.1!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!news.hub.org!.POSTED!postgresql.org!pgsql-general-owner+M191464=pgsql+2Dgeneral=news.postgresql.org
From: ja...@xnet.co.nz (Jasen Betts)
Newsgroups: pgsql.general
Subject: Re: Who is LISTENing?
Date: 16 Oct 2012 12:18:55 GMT
Organization: Dis (not Dat) Organisation
Lines: 37
Sender: n...@news.hub.org
Message-ID: <k5jjbf$jk5$1@reversiblemaps.ath.cx>
References: <20121015161138.GA17738@eldergods.com>
NNTP-Posting-Host: news.hub.org
Mime-Version: 1.0
X-Trace: news.hub.org 1350390691 88562 200.46.204.72 (16 Oct 2012 12:31:31 GMT)
X-Complaints-To: usenet@news.hub.org
NNTP-Posting-Date: Tue, 16 Oct 2012 12:31:31 +0000 (UTC)
X-Received: from malur.postgresql.org (malur.postgresql.org [217.196.149.56])
	by news.hub.org (8.14.5/8.14.5) with ESMTP id q9GCVUMl088550
	for <pgsql-gene...@news.postgresql.org>; Tue, 16 Oct 2012 09:31:30 -0300 (ADT)
	(envelope-from pgsql-general-owner+M191464=pgsql+2Dgeneral=news.postgresql....@postgresql.org)
X-Received: from localhost ([127.0.0.1] helo=postgresql.org)
	by malur.postgresql.org with smtp (Exim 4.72)
	(envelope-from <pgsql-general-owner+M191464=pgsql+2Dgeneral=news.postgresql....@postgresql.org>)
	id 1TO6Iz-0005qz-I6
	for pgsql-gene...@news.postgresql.org; Tue, 16 Oct 2012 12:31:29 +0000
X-Received: from magus.postgresql.org ([87.238.57.229])
	by malur.postgresql.org with esmtp (Exim 4.72)
	(envelope-from <sql-pgsql-genera...@m.gmane.org>)
	id 1TO6Iy-0005qZ-JS
	for pgsql-gene...@postgresql.org; Tue, 16 Oct 2012 12:31:28 +0000
X-Received: from plane.gmane.org ([80.91.229.3])
	by magus.postgresql.org with esmtp (Exim 4.72)
	(envelope-from <sql-pgsql-genera...@m.gmane.org>)
	id 1TO6Ip-0006RJ-So
	for pgsql-gene...@postgresql.org; Tue, 16 Oct 2012 12:31:28 +0000
X-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <sql-pgsql-genera...@m.gmane.org>)
	id 1TO6Iv-0003CV-7D
	for pgsql-gene...@postgresql.org; Tue, 16 Oct 2012 14:31:25 +0200
X-Received: from ip-118-90-32-68.xdsl.xnet.co.nz ([118.90.32.68])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <pgsql-gene...@postgresql.org>; Tue, 16 Oct 2012 14:31:25 +0200
X-Received: from jasen by ip-118-90-32-68.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <pgsql-gene...@postgresql.org>; Tue, 16 Oct 2012 14:31:25 +0200
X-Injected-Via-Gmane: http://gmane.org/
X-To: pgsql-gene...@postgresql.org
X-Lines: 29
X-Gmane-NNTP-Posting-Host: ip-118-90-32-68.xdsl.xnet.co.nz
X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s;a
 +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W;(T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6
 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q;8
 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^
X-User-Agent: slrn/pre1.0.0-18 (Linux)
X-Pg-Spam-Score: -2.3 (--)
X-List-Archive: <http://archives.postgresql.org/pgsql-general>
X-List-Help: <mailto:majord...@postgresql.org?body=help>
X-List-ID: <pgsql-general.postgresql.org>
X-List-Owner: <mailto:pgsql-general-ow...@postgresql.org>
X-List-Post: <mailto:pgsql-gene...@postgresql.org>
X-List-Subscribe: <mailto:majord...@postgresql.org?body=sub%20pgsql-general>
X-List-Unsubscribe: <mailto:majord...@postgresql.org?body=unsub%20pgsql-general>
X-Mailing-List: pgsql-general
X-Precedence: bulk
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On 2012-10-15, rektide <rekt...@voodoowarez.com> wrote:
> Hi pgsql-general,
>
> I'm interested in writing a supervisory process that can insure worker processes are
> running/spawn new ones if not. These workers will mainly be responsible for LISTENing to
> the db, which is emitting triggered_change_notification s.
>
> Is there any means to check a NOTIFY queue to see who or if anyone is LISTEN ing on it?
>

Notifies are not reliable, what I mean is they are "best effort"
this is unlike the other things postgres does, there's no guarantee
that you'll get the message, for example the network might go down at
the same time as the notifiy is emitted, if that happenss a listening
client would miss the notify message and by the time it reconnects the
message is gone.

If you need reliable mesaging use a mesage queue in a table:
Emit a notify when you insert into the queue and the listeners can check
the queue when they connect, and again after each notify.

OTOH, if best effort is good enough,  the table pg_stat_activity will give
you the username of each connected client. perhaps ypu can infer from that
who was probably listening when you last checked...



-- 
⚂⚃ 100% natural



-- 
Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general