JobRunner: rewrite GraphQL job
This commit is contained in:
parent
bc91b53072
commit
e4ce86dd3c
@ -2,24 +2,6 @@
|
|||||||
|
|
||||||
Public Class Config
|
Public Class Config
|
||||||
Public Property Debug As Boolean = False
|
Public Property Debug As Boolean = False
|
||||||
|
|
||||||
Public Property SQLConnectionString As String = ""
|
Public Property SQLConnectionString As String = ""
|
||||||
|
|
||||||
Public Property Firebird As New FirebirdConfig
|
|
||||||
Public Property Jobs As New List(Of JobConfig)
|
Public Property Jobs As New List(Of JobConfig)
|
||||||
|
|
||||||
'Public Enum JobType
|
|
||||||
' ADSync
|
|
||||||
' GraphQL
|
|
||||||
' Test
|
|
||||||
'End Enum
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Class FirebirdConfig
|
|
||||||
Public Property DataSource As String = "172.24.12.41"
|
|
||||||
Public Property Database As String = "172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB"
|
|
||||||
Public Property User As String = "sysdba"
|
|
||||||
Public Property Password As String = "dd"
|
|
||||||
End Class
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -11,17 +11,15 @@ Imports Quartz.Logging
|
|||||||
Public Class JobRunner
|
Public Class JobRunner
|
||||||
Private ReadOnly _LogConfig As LogConfig
|
Private ReadOnly _LogConfig As LogConfig
|
||||||
Private ReadOnly _Logger As DigitalData.Modules.Logging.Logger
|
Private ReadOnly _Logger As DigitalData.Modules.Logging.Logger
|
||||||
Private ReadOnly _firebird As Firebird
|
|
||||||
Private ReadOnly _mssql As MSSQLServer
|
Private ReadOnly _mssql As MSSQLServer
|
||||||
Private ReadOnly _config As Config
|
Private ReadOnly _config As Config
|
||||||
|
|
||||||
Private _factory As StdSchedulerFactory
|
Private _factory As StdSchedulerFactory
|
||||||
Private _scheduler As IScheduler
|
Private _scheduler As IScheduler
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pMSSQL As MSSQLServer, pFirebird As Firebird)
|
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pMSSQL As MSSQLServer)
|
||||||
_LogConfig = pLogConfig
|
_LogConfig = pLogConfig
|
||||||
_Logger = pLogConfig.GetLogger()
|
_Logger = pLogConfig.GetLogger()
|
||||||
_firebird = pFirebird
|
|
||||||
_mssql = pMSSQL
|
_mssql = pMSSQL
|
||||||
_config = pConfig
|
_config = pConfig
|
||||||
End Sub
|
End Sub
|
||||||
@ -64,7 +62,7 @@ Public Class JobRunner
|
|||||||
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(pJobConfig)
|
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(pJobConfig)
|
||||||
Dim oJobData As New JobDataMap From {
|
Dim oJobData As New JobDataMap From {
|
||||||
{"LogConfig", _LogConfig},
|
{"LogConfig", _LogConfig},
|
||||||
{"Firebird", _firebird},
|
{"Firebird", Nothing},
|
||||||
{"MSSQL", _mssql},
|
{"MSSQL", _mssql},
|
||||||
{"Args", oJobConfig.Args}
|
{"Args", oJobConfig.Args}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,6 @@ Public Class JobRunnerService
|
|||||||
Private _logger As Logger
|
Private _logger As Logger
|
||||||
Private _config As ConfigManager(Of Config)
|
Private _config As ConfigManager(Of Config)
|
||||||
Private _mssql As MSSQLServer
|
Private _mssql As MSSQLServer
|
||||||
Private _firebird As Firebird
|
|
||||||
Private _jobrunner As JobRunner
|
Private _jobrunner As JobRunner
|
||||||
|
|
||||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||||
@ -22,16 +21,13 @@ Public Class JobRunnerService
|
|||||||
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
|
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
|
||||||
_logConfig.Debug = _config.Config.Debug
|
_logConfig.Debug = _config.Config.Debug
|
||||||
|
|
||||||
Dim oFirebird = _config.Config.Firebird
|
|
||||||
|
|
||||||
_logger.Debug("Connecting to Database..")
|
_logger.Debug("Connecting to Database..")
|
||||||
|
|
||||||
_mssql = New MSSQLServer(_logConfig, _config.Config.SQLConnectionString)
|
_mssql = New MSSQLServer(_logConfig, _config.Config.SQLConnectionString)
|
||||||
_firebird = New Firebird(_logConfig, oFirebird.DataSource, oFirebird.Database, oFirebird.User, oFirebird.Password)
|
|
||||||
|
|
||||||
_logger.Debug("Starting Jobrunner..")
|
_logger.Debug("Starting Jobrunner..")
|
||||||
|
|
||||||
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql, _firebird)
|
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql)
|
||||||
_jobrunner.Start()
|
_jobrunner.Start()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
|
|||||||
@ -9,7 +9,6 @@ Public Class ADJob
|
|||||||
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
|
||||||
Dim oJobData = context.MergedJobDataMap
|
Dim oJobData = context.MergedJobDataMap
|
||||||
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
|
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 oArgs As Dictionary(Of String, String) = oJobData.Item("Args")
|
||||||
Dim oADJobArgs = New ADSyncArgs()
|
Dim oADJobArgs = New ADSyncArgs()
|
||||||
|
|
||||||
@ -25,16 +24,14 @@ Public Class ADJob
|
|||||||
oADJobArgs.GroupFilter = oArgs.Item("GroupFilter")
|
oADJobArgs.GroupFilter = oArgs.Item("GroupFilter")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then
|
Dim oFirebird = Nothing
|
||||||
oFirebird = Nothing
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
|
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
|
||||||
If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then
|
If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then
|
||||||
oMSSQL = Nothing
|
oMSSQL = Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
|
Dim oADSyncJob As New ADSyncJob(oLogConfig, oMSSQL)
|
||||||
oADSyncJob.Start(oADJobArgs)
|
oADSyncJob.Start(oADJobArgs)
|
||||||
|
|
||||||
Return Task.FromResult(True)
|
Return Task.FromResult(True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user