JobRunner: rewrite GraphQL job
This commit is contained in:
parent
bc91b53072
commit
e4ce86dd3c
@ -2,24 +2,6 @@
|
||||
|
||||
Public Class Config
|
||||
Public Property Debug As Boolean = False
|
||||
|
||||
Public Property SQLConnectionString As String = ""
|
||||
|
||||
Public Property Firebird As New FirebirdConfig
|
||||
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
|
||||
|
||||
@ -11,17 +11,15 @@ Imports Quartz.Logging
|
||||
Public Class JobRunner
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
Private ReadOnly _Logger As DigitalData.Modules.Logging.Logger
|
||||
Private ReadOnly _firebird As Firebird
|
||||
Private ReadOnly _mssql As MSSQLServer
|
||||
Private ReadOnly _config As Config
|
||||
|
||||
Private _factory As StdSchedulerFactory
|
||||
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
|
||||
_Logger = pLogConfig.GetLogger()
|
||||
_firebird = pFirebird
|
||||
_mssql = pMSSQL
|
||||
_config = pConfig
|
||||
End Sub
|
||||
@ -64,7 +62,7 @@ Public Class JobRunner
|
||||
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(pJobConfig)
|
||||
Dim oJobData As New JobDataMap From {
|
||||
{"LogConfig", _LogConfig},
|
||||
{"Firebird", _firebird},
|
||||
{"Firebird", Nothing},
|
||||
{"MSSQL", _mssql},
|
||||
{"Args", oJobConfig.Args}
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ Public Class JobRunnerService
|
||||
Private _logger As Logger
|
||||
Private _config As ConfigManager(Of Config)
|
||||
Private _mssql As MSSQLServer
|
||||
Private _firebird As Firebird
|
||||
Private _jobrunner As JobRunner
|
||||
|
||||
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)
|
||||
_logConfig.Debug = _config.Config.Debug
|
||||
|
||||
Dim oFirebird = _config.Config.Firebird
|
||||
|
||||
_logger.Debug("Connecting to Database..")
|
||||
|
||||
_mssql = New MSSQLServer(_logConfig, _config.Config.SQLConnectionString)
|
||||
_firebird = New Firebird(_logConfig, oFirebird.DataSource, oFirebird.Database, oFirebird.User, oFirebird.Password)
|
||||
|
||||
_logger.Debug("Starting Jobrunner..")
|
||||
|
||||
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql, _firebird)
|
||||
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql)
|
||||
_jobrunner.Start()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
|
||||
@ -9,7 +9,6 @@ Public Class ADJob
|
||||
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()
|
||||
|
||||
@ -25,16 +24,14 @@ Public Class ADJob
|
||||
oADJobArgs.GroupFilter = oArgs.Item("GroupFilter")
|
||||
End If
|
||||
|
||||
If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then
|
||||
oFirebird = Nothing
|
||||
End If
|
||||
Dim oFirebird = Nothing
|
||||
|
||||
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)
|
||||
Dim oADSyncJob As New ADSyncJob(oLogConfig, oMSSQL)
|
||||
oADSyncJob.Start(oADJobArgs)
|
||||
|
||||
Return Task.FromResult(True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user