Service GDPicture
This commit is contained in:
@@ -26,47 +26,52 @@ Public Class Scheduler
|
||||
End Sub
|
||||
|
||||
Public Async Function Start(pInterval As Integer) As Task
|
||||
Logger.Debug("Starting Scheduler..")
|
||||
Try
|
||||
Logger.Debug("Starting Scheduler..")
|
||||
|
||||
Dim oProperties As New NameValueCollection()
|
||||
Dim oProperties As New NameValueCollection()
|
||||
|
||||
Scheduler = Await SchedulerBuilder.Create(oProperties).
|
||||
UseDefaultThreadPool(Sub(x) x.MaxConcurrency = 5).
|
||||
BuildScheduler()
|
||||
Scheduler = Await SchedulerBuilder.Create(oProperties).
|
||||
UseDefaultThreadPool(Sub(x) x.MaxConcurrency = 5).
|
||||
BuildScheduler()
|
||||
|
||||
Dim oJobKey = New JobKey(JobName)
|
||||
Dim oJobData = New JobDataMap() From {
|
||||
{Common.Constants.GDPICTURE, LicenseKey},
|
||||
{Common.Constants.LOGCONFIG, LogConfig},
|
||||
{Common.Constants.DATABASE, ConnectionString},
|
||||
{Common.Constants.IGNORED_LABELS, _ignoredLabels}
|
||||
}
|
||||
Dim oJobKey = New JobKey(JobName)
|
||||
Dim oJobData = New JobDataMap() From {
|
||||
{Common.Constants.GDPICTURE, LicenseKey},
|
||||
{Common.Constants.LOGCONFIG, LogConfig},
|
||||
{Common.Constants.DATABASE, ConnectionString},
|
||||
{Common.Constants.IGNORED_LABELS, _ignoredLabels}
|
||||
}
|
||||
|
||||
Logger.Debug("Initialized Job [{0}]", JobName)
|
||||
Logger.Debug("Initialized Job [{0}]", JobName)
|
||||
|
||||
Dim oJob As IJobDetail = JobBuilder.Create(Of FinalizeDocumentJob).
|
||||
UsingJobData(oJobData).
|
||||
WithIdentity(oJobKey).
|
||||
Build()
|
||||
Dim oJob As IJobDetail = JobBuilder.Create(Of FinalizeDocumentJob).
|
||||
UsingJobData(oJobData).
|
||||
WithIdentity(oJobKey).
|
||||
Build()
|
||||
|
||||
Dim oTrigger As ITrigger = TriggerBuilder.Create().
|
||||
ForJob(oJobKey).
|
||||
WithIdentity($"{JobName}-trigger").
|
||||
WithSimpleSchedule(Sub(s) s.
|
||||
RepeatForever().
|
||||
WithIntervalInMinutes(pInterval)).
|
||||
StartNow().
|
||||
Build()
|
||||
Dim oTrigger As ITrigger = TriggerBuilder.Create().
|
||||
ForJob(oJobKey).
|
||||
WithIdentity($"{JobName}-trigger").
|
||||
WithSimpleSchedule(Sub(s) s.
|
||||
RepeatForever().
|
||||
WithIntervalInMinutes(pInterval)).
|
||||
StartNow().
|
||||
Build()
|
||||
|
||||
Logger.Debug("Initialized Trigger")
|
||||
Logger.Debug("Initialized Trigger")
|
||||
|
||||
Await Scheduler.ScheduleJob(oJob, oTrigger)
|
||||
Await Scheduler.ScheduleJob(oJob, oTrigger)
|
||||
|
||||
Logger.Debug("Job scheduled.")
|
||||
Logger.Debug("Job scheduled.")
|
||||
|
||||
Await Scheduler.Start()
|
||||
Await Scheduler.Start()
|
||||
|
||||
Logger.Info("Scheduler started!")
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
Logger.Info("Scheduler started!")
|
||||
End Function
|
||||
|
||||
Public Async Function [Stop]() As Task
|
||||
|
||||
Reference in New Issue
Block a user