update jobrunner
This commit is contained in:
34
Service.JobRunner/Jobs/ADJob.vb
Normal file
34
Service.JobRunner/Jobs/ADJob.vb
Normal file
@@ -0,0 +1,34 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Jobs
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Quartz
|
||||
|
||||
Public Class ADJob
|
||||
Implements Quartz.IJob
|
||||
|
||||
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
||||
Dim oJobData = context.MergedJobDataMap
|
||||
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
|
||||
Dim oFirebird As Firebird = oJobData.Item("Firebird")
|
||||
Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args")
|
||||
Dim oADJobArgs = New ADSyncArgs()
|
||||
|
||||
If oArgs.ContainsKey("RootPath") Then
|
||||
oADJobArgs.RootPath = oArgs.Item("RootPath")
|
||||
End If
|
||||
|
||||
If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then
|
||||
oFirebird = Nothing
|
||||
End If
|
||||
|
||||
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
|
||||
If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then
|
||||
oMSSQL = Nothing
|
||||
End If
|
||||
|
||||
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
|
||||
oADSyncJob.Start(oADJobArgs)
|
||||
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
End Class
|
||||
23
Service.JobRunner/Jobs/TestJob.vb
Normal file
23
Service.JobRunner/Jobs/TestJob.vb
Normal file
@@ -0,0 +1,23 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports Quartz
|
||||
|
||||
Public Class TestJob
|
||||
Implements Quartz.IJob
|
||||
|
||||
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
||||
Dim oJobData = context.MergedJobDataMap
|
||||
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
|
||||
Dim oLogger = oLogConfig.GetLogger()
|
||||
|
||||
Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args")
|
||||
|
||||
If oArgs.ContainsKey("Arg1") Then
|
||||
Dim oArg1 As String = oArgs.Item("Arg1")
|
||||
oLogger.Info("Running Test Job With Arg1: {0}", oArg1)
|
||||
Else
|
||||
oLogger.Warn("Running Test Job With missing Arg1 :/")
|
||||
End If
|
||||
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user