43 lines
1.5 KiB
VB.net
43 lines
1.5 KiB
VB.net
Imports System.IO
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Logging.LogConfig
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Config
|
|
|
|
Public Class JobRunnerService
|
|
Private _logConfig As LogConfig
|
|
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)
|
|
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"))
|
|
_logger = _logConfig.GetLogger()
|
|
_logger.Info("Starting Service {0}", ServiceName)
|
|
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
|
|
|
|
Dim oFirebird = _config.Config.Firebird
|
|
|
|
Try
|
|
_mssql = New MSSQLServer(_logConfig, _config.Config.SQLConnectionString)
|
|
_firebird = New Firebird(_logConfig, oFirebird.DataSource, oFirebird.Database, oFirebird.User, oFirebird.Password)
|
|
Catch ex As Exception
|
|
_logger.Error(ex)
|
|
End Try
|
|
|
|
Try
|
|
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql, _firebird)
|
|
_jobrunner.Start()
|
|
Catch ex As Exception
|
|
_logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Protected Overrides Sub OnStop()
|
|
_jobrunner.Stop()
|
|
_logger.Info("Stopping Service {0}", ServiceName)
|
|
End Sub
|
|
End Class
|