Async_Notify

Started by Арсен Арутюнянover 6 years ago4 messageshackers
Jump to latest

Hello! I wrote my extension for PG and am trying to run Async_Notify from it. But messages come very late! Sometimes only after I execute the notify command from the shell. What am I doing wrong? How to use Async_Notify correctly.
 
--
Арсен Арутюнян

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Арсен Арутюнян (#1)
Re: Async_Notify

Hi

pá 13. 12. 2019 v 10:00 odesílatel Арсен Арутюнян <arutar@bk.ru> napsal:

Hello! I wrote my extension for PG and am trying to run Async_Notify from
it. But messages come very late! Sometimes only after I execute the notify
command from the shell. What am I doing wrong? How to use Async_Notify
correctly.

I am not sure what mechanism do you use.

Notify messages are send after successful end of transaction.

Regards

Pavel

Show quoted text

--
Арсен Арутюнян

In reply to: Pavel Stehule (#2)
Re[2]: Async_Notify

I'm trying to send a notification from the PG extension directly.
It turns out the mechanism that is used in the async file. (Async_Notify) does not suit me since the function uses oldcontext = MemoryContextSwitchTo (CurTransactionContext); and MemoryContextSwitchTo (oldcontext);
And I did not find the ability to add notification except the Async_Notify function.
 
Now only SPI_execute works ("NOTIFY chanel,’message’", false, 0);
 
P.S. In my extension, there is already a higher function started with oldcontext = MemoryContextSwitchTo (CurTransactionContext); and MemoryContextSwitchTo (oldcontext);
 
   

Пятница, 13 декабря 2019, 12:19 +03:00 от Pavel Stehule <pavel.stehule@gmail.com>:
 
Hi  
pá 13. 12. 2019 v 10:00 odesílatel Арсен Арутюнян < arutar@bk.ru > napsal:

Hello! I wrote my extension for PG and am trying to run Async_Notify from it. But messages come very late! Sometimes only after I execute the notify command from the shell. What am I doing wrong? How to use Async_Notify correctly.
 

 
I am not sure what mechanism do you use.
 
Notify messages are send after successful  end of transaction.
 
Regards
 
Pavel
 

--
Арсен Арутюнян

 
 
--
Арсен Арутюнян
 

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Арсен Арутюнян (#3)
Re: Re[2]: Async_Notify

pá 13. 12. 2019 v 12:30 odesílatel Арсен Арутюнян <arutar@bk.ru> napsal:

I'm trying to send a notification from the PG extension directly.
It turns out the mechanism that is used in the async file. (Async_Notify)
does not suit me since the function uses oldcontext = MemoryContextSwitchTo
(CurTransactionContext); and MemoryContextSwitchTo (oldcontext);
And I did not find the ability to add notification except the Async_Notify
function.

Now only SPI_execute works ("NOTIFY chanel,’message’", false, 0);

P.S. In my extension, there is already a higher function started with
oldcontext = MemoryContextSwitchTo (CurTransactionContext); and
MemoryContextSwitchTo (oldcontext);

NOTIFY just push message to queue and waiting on end of transaction.

This is by design and you cannot to change it.

Regards

Pavel

Show quoted text

Пятница, 13 декабря 2019, 12:19 +03:00 от Pavel Stehule <
pavel.stehule@gmail.com>:

Hi

pá 13. 12. 2019 v 10:00 odesílatel Арсен Арутюнян <arutar@bk.ru
<//e.mail.ru/compose/?mailto=mailto%3aarutar@bk.ru>> napsal:

Hello! I wrote my extension for PG and am trying to run Async_Notify from
it. But messages come very late! Sometimes only after I execute the notify
command from the shell. What am I doing wrong? How to use Async_Notify
correctly.

I am not sure what mechanism do you use.

Notify messages are send after successful end of transaction.

Regards

Pavel

--
Арсен Арутюнян

--
Арсен Арутюнян