update jobrunner
This commit is contained in:
parent
811613cdea
commit
5343e051e9
@ -90,55 +90,8 @@ Public Class JobRunner
|
|||||||
Await _scheduler.Shutdown()
|
Await _scheduler.Shutdown()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
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 oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
Private Class LogProvider
|
Private Class LogProvider
|
||||||
Implements ILogProvider
|
Implements ILogProvider
|
||||||
|
|||||||
@ -87,6 +87,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="JobRunner.vb" />
|
<Compile Include="JobRunner.vb" />
|
||||||
|
<Compile Include="Jobs\ADJob.vb" />
|
||||||
|
<Compile Include="Jobs\TestJob.vb" />
|
||||||
<Compile Include="My Project\Application.Designer.vb">
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
@ -148,6 +150,10 @@
|
|||||||
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||||
<Name>Database</Name>
|
<Name>Database</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Modules.Jobs\Jobs.vbproj">
|
||||||
|
<Project>{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}</Project>
|
||||||
|
<Name>Jobs</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||||
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||||
<Name>Logging</Name>
|
<Name>Logging</Name>
|
||||||
|
|||||||
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
|
||||||
Loading…
x
Reference in New Issue
Block a user