postgresqlquartz.netjob-schedulingpgagent

Is there a way that we can manage PgAgent Jobs on a C#/.NET application? Any library or third party tool? (PostgreSQL)


We know that there is SQL Server Agent, functions as Job Scheduler, in MSSQL. If we want to manage jobs on Server Agent, with a C#/.NET application, we can use Microsoft.SqlServer.Management.Smo library and start a connection between two (SQL Server Agent and C#/.NET code). By this way, we can use SQL Server Agent in code side too (by managing scheduled jobs from code as well as from database side).

Now, think about PostgreSQL, and not MSSQL. In PostgreSQL, I know that there is an extension called PgAgent doing the exact same thing as SQL Server Agent. My question is that, is there any library or third party tool that can help me manage PgAgent Jobs on a C#/.NET application? This so called library should be in a communication with PgAgent, I guess.

I heard of a third party tool Quartz.Net and searched into it a little. I guess it provides management control of job scheduling on PostgreSQL with JobStores. It is creating an environment on PostgreSQL with its database and tables. Actually Quartz.Net can work without the PgAgent extension but I wanna know that if it can work with PgAgent also. I mean if it can connect to PgAgent from code side and help me manage jobs on PgAgent or not.


Solution

  • Yes, you can use Quartz.Net to manage jobs on PostgreSQL, including those managed by PgAgent. quartz

    To use Quartz.Net with PostgreSQL, you must configure it to use the appropriate database driver and connection string. You must also set the required database schema using the SQL scripts provided by Quartz.Net. Once complete, you can use the Quartz.Net API to create, modify, and delete jobs, and schedule them to run at specific times.

    If you already use PgAgent to manage jobs on your PostgreSQL server, you can continue to use it with Quartz.Net. Note, however, that Quartz.Net provides its own job scheduling system, so you may need to do some additional configuration to ensure that jobs created in Quartz.Net are properly synchronized with jobs managed by PgAgent.