Re: A method to asynchronously LISTEN ?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Philippe Ebersohl <philippe(dot)ebersohl(at)dalim(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: A method to asynchronously LISTEN ?
Date: 2019-02-26 19:04:09
Message-ID: CADK3HHLzb2RjFc7T_ccJ0nhC6Gx457TCGu0==YtVNWXcG=xsrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 26 Feb 2019 at 12:29, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> The question being asked is whether executeUpdate method performs
> synchronous execution of the listener function queue during its execution.
>
> This after sending the command to the server and the server completing
> execution of the NOTIFY. This assumes that the server places the
> notification on the channel for pick-up immediately (which will not be the
> case within a transaction).
>
> While the client is, IIRC, synchronous, thus the local order of operations
> can be controlled, the server is asynchronous and thus this test is exposed
> to timing issues. Maybe we need something like conn.listenSync() that
> blocks until a notification payload is received on the connection...?
>

kind of defeats the asynchronous aspect, no ?

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

> David J.
>
> On Mon, Feb 25, 2019 at 8:14 AM Dave Cramer <pg(at)fastcrypt(dot)com> wrote:
>
>> Philippe
>>
>>
>>
>>
>> On Mon, 25 Feb 2019 at 04:15, Philippe Ebersohl <
>> philippe(dot)ebersohl(at)dalim(dot)com> wrote:
>>
>>> Hello Dave,
>>>
>>> This is, sir, what we would like !
>>>
>>> However looking at line 47-50 of
>>> pgjdbc/src/test/java/org/postgresql/test/jdbc2/NotifyTest.java
>>> <https://github.com/pgjdbc/pgjdbc/pull/579/commits/229d10adf6686805004491a0d94de076d8e1a3ea#diff-d8d2d4b4d2f26fb01b761a7a12be0741>
>>>
>>> How do we guaranty that the listener is called before the assertTrue()
>>> is fired ?
>>>
>>> stmt.executeUpdate("NOTIFY mynotification");
>>>
>>>
>>>
>>> assertTrue(flag.get());
>>>
>>
>> I'm not sure exactly what you mean
>>
>> Dave Cramer
>>
>> davec(at)postgresintl(dot)com
>> www.postgresintl.com
>>
>>
>> *From: *"Dave Cramer" <pg(at)fastcrypt(dot)com>
>>> *To: *"Philippe Ebersohl" <philippe(dot)ebersohl(at)dalim(dot)com>
>>> *Cc: *"List" <pgsql-jdbc(at)postgresql(dot)org>
>>> *Sent: *Friday, 22 February, 2019 20:03:46
>>> *Subject: *Re: A method to asynchronously LISTEN ?
>>>
>>> Hi Philippe,
>>> So this is old, but I didn't get much response
>>> https://github.com/pgjdbc/pgjdbc/pull/579
>>>
>>> have a look and see if it works for you. If so we can look at putting it
>>> in.
>>>
>>> Dave Cramer
>>>
>>> davec(at)postgresintl(dot)com
>>> www.postgresintl.com
>>>
>>>
>>> On Sat, 16 Feb 2019 at 03:36, Philippe Ebersohl <
>>> philippe(dot)ebersohl(at)dalim(dot)com> wrote:
>>>
>>>> Hello,
>>>> I checked the documentation and FAQ at jdbc.postgresql.org
>>>> Is there a roadmap of feature implementation for the jdbc driver ?
>>>>
>>>> Are there plans to include something similar to
>>>> the PGNotificationListener found in pgjdbc-ng?
>>>> Which does not require to send SELECT to the postgres.
>>>>
>>>> We would if possible only use one postgresql jdbc driver.
>>>>
>>>> I hope I hit the right list for my questions.
>>>> Thank you.
>>>>
>>>> Best regards,
>>>> Philippe Ebersohl
>>>>
>>>>
>>>>
>>>> (null)
>>>>
>>>>
>>>>
>>>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David G. Johnston 2019-02-26 21:17:12 Re: A method to asynchronously LISTEN ?
Previous Message David G. Johnston 2019-02-26 17:29:21 Re: A method to asynchronously LISTEN ?