agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
LISTEN/NOTIFY
9+ messages / 5 participants
[nested] [flat]

* LISTEN/NOTIFY
@ 2005-11-25 14:31  Stéphane RIFF <stephane.riff@cerene.fr>
  0 siblings, 0 replies; 9+ messages in thread

From: Stéphane RIFF @ 2005-11-25 14:31 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

I just saw in the documentation the LISTEN/NOTIFY commands but i don't 
understand how i can use them.

Can someone show me an example in PLPGSQL that use this system ?

=> A process send a NOTIFY command and a LISTEN process execute his own 
commands.

Hope this clear, thanks
Steff



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN/NOTIFY
@ 2005-11-25 16:24  Stéphane RIFF <stephane.riff@cerene.fr>
  0 siblings, 0 replies; 9+ messages in thread

From: Stéphane RIFF @ 2005-11-25 16:24 UTC (permalink / raw)
  To: pgsql-sql

Forget about this post, i hadn't well understand what i can do with this 
system,
now i find an example in the 8.0 doc with libpq that show me how it works

Sorry
THX
Steff



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* LISTEN / NOTIFY
@ 2021-10-11 14:11  aditya desai <admad123@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread

From: aditya desai @ 2021-10-11 14:11 UTC (permalink / raw)
  To: pgsql-sql <pgsql-sql@lists.postgresql.org>

Hi,
Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages to
and from Postgres? Do you have steps to implement it?

Regards.
Aditya.

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 14:52  Erik Brandsberg <erik@heimdalldata.com>
  parent: aditya desai <admad123@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Erik Brandsberg @ 2021-10-11 14:52 UTC (permalink / raw)
  To: aditya desai <admad123@gmail.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>

You will need to provide more info, such as what language and driver you
are trying to implement this with.  I have implemented it with Java, but
the driver has a specific API to implement this.

On Mon, Oct 11, 2021 at 10:12 AM aditya desai <admad123@gmail.com> wrote:

> Hi,
> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages to
> and from Postgres? Do you have steps to implement it?
>
> Regards.
> Aditya.
>


-- 
*Erik Brandsberg*
erik@heimdalldata.com

www.heimdalldata.com
+1 (866) 433-2824 x 700
[image: AWS Competency Program]
<https://aws.amazon.com/partners/find/partnerdetails/?n=Heimdall%20Data&id=001E000001d9pndIAA;

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 15:31  aditya desai <admad123@gmail.com>
  parent: Erik Brandsberg <erik@heimdalldata.com>
  0 siblings, 1 reply; 9+ messages in thread

From: aditya desai @ 2021-10-11 15:31 UTC (permalink / raw)
  To: Erik Brandsberg <erik@heimdalldata.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>

Hi Erik,
Thanks for response. We will be implementing it in Java or .NET. Could you
please send steps for Java?

I am not a Java expert and I am completely DB person. So do we need
external API to enqueue and dqueue messages. Completely new to this
concept. Please bear with me :)

Regards,
Aditya.

On Monday, October 11, 2021, Erik Brandsberg <erik@heimdalldata.com> wrote:

> You will need to provide more info, such as what language and driver you
> are trying to implement this with.  I have implemented it with Java, but
> the driver has a specific API to implement this.
>
> On Mon, Oct 11, 2021 at 10:12 AM aditya desai <admad123@gmail.com> wrote:
>
>> Hi,
>> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages to
>> and from Postgres? Do you have steps to implement it?
>>
>> Regards.
>> Aditya.
>>
>
>
> --
> *Erik Brandsberg*
> erik@heimdalldata.com
>
> www.heimdalldata.com
> +1 (866) 433-2824 x 700
> [image: AWS Competency Program]
> <https://aws.amazon.com/partners/find/partnerdetails/?n=Heimdall%20Data&id=001E000001d9pndIAA;
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 15:36  David G. Johnston <david.g.johnston@gmail.com>
  parent: aditya desai <admad123@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: David G. Johnston @ 2021-10-11 15:36 UTC (permalink / raw)
  To: aditya desai <admad123@gmail.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>

On Monday, October 11, 2021, aditya desai <admad123@gmail.com> wrote:

> Hi,
> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages to
> and from Postgres? Do you have steps to implement it?
>

Listen/notify are not a queuing system, they are a notification system.

David J.

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 15:46  Steve Midgley <science@misuse.org>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Steve Midgley @ 2021-10-11 15:46 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: aditya desai <admad123@gmail.com>; pgsql-sql <pgsql-sql@lists.postgresql.org>

On Mon, Oct 11, 2021 at 8:36 AM David G. Johnston <
david.g.johnston@gmail.com> wrote:

>
>
> On Monday, October 11, 2021, aditya desai <admad123@gmail.com> wrote:
>
>> Hi,
>> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages to
>> and from Postgres? Do you have steps to implement it?
>>
>
> Listen/notify are not a queuing system, they are a notification system.
>

I agree with David - you _could_ implement a work queue using LISTEN /
NOTIFY as primitive components, but they are not anything like a complete
queuing system. I would recommend implementing any number of open source or
licensed message queue solutions that will work with Postgres. RabbitMQ is
widely known and used. I've used SideKiq and Resque (both being in Ruby, a
language I like). I think it would be unwise to implement your own queue
system directly on top of LISTEN/NOTIFY. There are so many edge cases to
queue management, it's almost like implementing your own encryption
algorithm on top of Postgres' math functions. There are OSS tools out there
that will almost certainly do what you want.

Steve

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 16:36  aditya desai <admad123@gmail.com>
  parent: Steve Midgley <science@misuse.org>
  0 siblings, 0 replies; 9+ messages in thread

From: aditya desai @ 2021-10-11 16:36 UTC (permalink / raw)
  To: Steve Midgley <science@misuse.org>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-sql <pgsql-sql@lists.postgresql.org>

Steve/David,
Thanks for response. I will look into this further.

Regards,
Aditya.

On Monday, October 11, 2021, Steve Midgley <science@misuse.org> wrote:

>
> On Mon, Oct 11, 2021 at 8:36 AM David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>>
>>
>> On Monday, October 11, 2021, aditya desai <admad123@gmail.com> wrote:
>>
>>> Hi,
>>> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages
>>> to and from Postgres? Do you have steps to implement it?
>>>
>>
>> Listen/notify are not a queuing system, they are a notification system.
>>
>
> I agree with David - you _could_ implement a work queue using LISTEN /
> NOTIFY as primitive components, but they are not anything like a complete
> queuing system. I would recommend implementing any number of open source or
> licensed message queue solutions that will work with Postgres. RabbitMQ is
> widely known and used. I've used SideKiq and Resque (both being in Ruby, a
> language I like). I think it would be unwise to implement your own queue
> system directly on top of LISTEN/NOTIFY. There are so many edge cases to
> queue management, it's almost like implementing your own encryption
> algorithm on top of Postgres' math functions. There are OSS tools out there
> that will almost certainly do what you want.
>
> Steve
>
>
>
>
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: LISTEN / NOTIFY
@ 2021-10-11 16:59  Erik Brandsberg <erik@heimdalldata.com>
  parent: aditya desai <admad123@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Erik Brandsberg @ 2021-10-11 16:59 UTC (permalink / raw)
  To: aditya desai <admad123@gmail.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>

As others have said, a queue system and message system are not exactly the
same.   Can you explain your goal, as the listen/notify may not be
appropriate for your use.  If what you want is really just a message
system, then the example we based our code on is at
https://jdbc.postgresql.org/documentation/81/listennotify.html.

Keep in mind, if you connect (or reconnect) to the listen interface, you
won't get any messages sent before it, so it isn't exactly what you want if
you need a persistent queue, say for a job queue.  We use it for
invalidating cache content.

On Mon, Oct 11, 2021 at 11:31 AM aditya desai <admad123@gmail.com> wrote:

> Hi Erik,
> Thanks for response. We will be implementing it in Java or .NET. Could you
> please send steps for Java?
>
> I am not a Java expert and I am completely DB person. So do we need
> external API to enqueue and dqueue messages. Completely new to this
> concept. Please bear with me :)
>
> Regards,
> Aditya.
>
> On Monday, October 11, 2021, Erik Brandsberg <erik@heimdalldata.com>
> wrote:
>
>> You will need to provide more info, such as what language and driver you
>> are trying to implement this with.  I have implemented it with Java, but
>> the driver has a specific API to implement this.
>>
>> On Mon, Oct 11, 2021 at 10:12 AM aditya desai <admad123@gmail.com> wrote:
>>
>>> Hi,
>>> Has anyone implemented LISTEN / NOTIFY to enqueue and dequeue messages
>>> to and from Postgres? Do you have steps to implement it?
>>>
>>> Regards.
>>> Aditya.
>>>
>>
>>
>> --
>> *Erik Brandsberg*
>> erik@heimdalldata.com
>>
>> www.heimdalldata.com
>> +1 (866) 433-2824 x 700
>> [image: AWS Competency Program]
>> <https://aws.amazon.com/partners/find/partnerdetails/?n=Heimdall%20Data&id=001E000001d9pndIAA;
>>
>

-- 
*Erik Brandsberg*
erik@heimdalldata.com

www.heimdalldata.com
+1 (866) 433-2824 x 700
[image: AWS Competency Program]
<https://aws.amazon.com/partners/find/partnerdetails/?n=Heimdall%20Data&id=001E000001d9pndIAA;

^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2021-10-11 16:59 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-25 14:31 LISTEN/NOTIFY Stéphane RIFF <stephane.riff@cerene.fr>
2005-11-25 16:24 Re: LISTEN/NOTIFY Stéphane RIFF <stephane.riff@cerene.fr>
2021-10-11 14:11 LISTEN / NOTIFY aditya desai <admad123@gmail.com>
2021-10-11 14:52 ` Re: LISTEN / NOTIFY Erik Brandsberg <erik@heimdalldata.com>
2021-10-11 15:31   ` Re: LISTEN / NOTIFY aditya desai <admad123@gmail.com>
2021-10-11 16:59     ` Re: LISTEN / NOTIFY Erik Brandsberg <erik@heimdalldata.com>
2021-10-11 15:36 ` Re: LISTEN / NOTIFY David G. Johnston <david.g.johnston@gmail.com>
2021-10-11 15:46   ` Re: LISTEN / NOTIFY Steve Midgley <science@misuse.org>
2021-10-11 16:36     ` Re: LISTEN / NOTIFY aditya desai <admad123@gmail.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox