06-12-2022
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ECM.JobRunner.Common
|
||||
Imports Quartz
|
||||
|
||||
Namespace Scheduler.Jobs
|
||||
@@ -7,15 +8,30 @@ Namespace Scheduler.Jobs
|
||||
Friend LogConfig As LogConfig
|
||||
Friend Logger As Logger
|
||||
Friend Database As MSSQLServer
|
||||
Friend State As State
|
||||
|
||||
Private ctx As IJobExecutionContext
|
||||
|
||||
Public Function InitializeJob(context As IJobExecutionContext) As Dictionary(Of String, String)
|
||||
ctx = context
|
||||
|
||||
Dim oJobData = context.MergedJobDataMap
|
||||
LogConfig = oJobData.Item(Constants.Scheduler.JOB_CONFIG_LOGCONFIG)
|
||||
Database = oJobData.Item(Constants.Scheduler.JOB_CONFIG_DATABASE)
|
||||
State = oJobData.Item(Constants.Scheduler.JOB_CONFIG_STATE)
|
||||
Logger = LogConfig.GetLogger()
|
||||
|
||||
State.JobStatus.Start(ctx)
|
||||
Return oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS)
|
||||
End Function
|
||||
|
||||
Public Sub UpdateProgress(pCurrentValue As Integer, pTotalValue As Integer)
|
||||
State.JobStatus.Update(ctx, pCurrentValue, pTotalValue)
|
||||
End Sub
|
||||
|
||||
Public Sub CompleteJob()
|
||||
State.JobStatus.Complete(ctx)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -19,6 +19,7 @@ Namespace Scheduler.Jobs
|
||||
|
||||
context.Result = oResult
|
||||
|
||||
CompleteJob()
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -13,12 +13,19 @@ Namespace Scheduler.Jobs
|
||||
|
||||
Logger.Info("Running File Import [{0}]", oName)
|
||||
|
||||
Dim oMax = 100
|
||||
For index = 1 To oMax
|
||||
UpdateProgress(index, oMax)
|
||||
Threading.Thread.Sleep(100)
|
||||
Next
|
||||
|
||||
Dim oResult = New JobResult() With {
|
||||
.Description = $"File Import Job [{oName}] completed!"
|
||||
}
|
||||
|
||||
context.Result = oResult
|
||||
|
||||
CompleteJob()
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -18,6 +18,7 @@ Namespace Scheduler.Jobs
|
||||
|
||||
context.Result = oResult
|
||||
|
||||
CompleteJob()
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user