Search Postgresql Archives

How to run a task continuously in the background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 

another oracle -> postgreSQL migration question.

 

I have a database in which a job runs continuously to perform tasks that are inserted into a table in the form of records.

The current Oracle implementation is to use DBMS_JOB to start a job (to be precise, there can be multiple jobs working in parallel) that goes through the following loop:

  • is there anything to do?
    • Yes -> Do Tasks
    • No  -> 1 second sleep
  • Was the EXIT command sent to me?
    • Yes -> Exit loop.

 

The question now is how do I start in PostgreSQL a background task that meets the following requirements:

  1. It must continue to run even if the connection in which the task was started is terminated.
  2. I need to be able to check if a background task exists.
  3. I need to be able to finish the background task without explicitly sending the EXIT command (see above) to the task.

 

I've already looked at the pg_background extension, but I don't think it meets either requirement 2 or requirement 3. But maybe I just didn’t look hard enough. And with regard to requirement 1, I'm not sure that's guaranteed.

 

Any suggestions on how this might be realized. Preferably without an external application.

 

BR

Dirk

--
Dirk Mika
Software Developer



mika:timing GmbH
Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk.mika@xxxxxxxxxxxxx
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika


 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux