work on jobrunner

This commit is contained in:
Jonathan Jenne
2019-04-10 11:43:15 +02:00
parent 720618f29b
commit 2855cc6208
14 changed files with 103 additions and 54 deletions

View File

@@ -19,9 +19,6 @@
<setting name="JOB_ADSYNC_ENABLED" serializeAs="String">
<value>False</value>
</setting>
<setting name="JOB_ADSYNC_INTERVAL" serializeAs="String">
<value>1,2,3,4,5,6,7,8,9,10</value>
</setting>
<setting name="DB_DATASOURCE" serializeAs="String">
<value />
</setting>
@@ -37,6 +34,12 @@
<setting name="JOB_INTERVAL" serializeAs="String">
<value>120</value>
</setting>
<setting name="JOB_ADSYNC_INTERVAL" serializeAs="String">
<value>120</value>
</setting>
<setting name="JOB_ADSYNC_ROOT_PATH" serializeAs="String">
<value />
</setting>
</DigitalData.Services.JobRunner.My.MySettings>
</applicationSettings>
</configuration>

View File

@@ -60,8 +60,17 @@ Public Class JobRunner
_logger.Debug("Background worker running..")
' TODO: WORK
'Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird)
'job.Start(args)
Dim oJob As New ADSyncJob(_logConfig, _firebird)
Dim oArgs As New ADSyncArgs() With {
.Enabled = My.Settings.JOB_ADSYNC_ENABLED,
.Interval = My.Settings.JOB_ADSYNC_INTERVAL,
.RootPath = My.Settings.JOB_ADSYNC_ROOT_PATH
}
If oJob.ShouldStart(oArgs) Then
oJob.Start(oArgs)
End If
Catch ex As Exception
_logger.Warn("Background worker failed!")
_logger.Error(ex)

View File

@@ -47,13 +47,6 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DigitalData.Controls.LookupGrid">
<HintPath>..\LookupGrid\obj\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>

View File

@@ -81,15 +81,6 @@ Namespace My
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("1,2,3,4,5,6,7,8,9,10")> _
Public ReadOnly Property JOB_ADSYNC_INTERVAL() As String
Get
Return CType(Me("JOB_ADSYNC_INTERVAL"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
@@ -134,6 +125,24 @@ Namespace My
Return CType(Me("JOB_INTERVAL"),Long)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("120")> _
Public ReadOnly Property JOB_ADSYNC_INTERVAL() As Long
Get
Return CType(Me("JOB_ADSYNC_INTERVAL"),Long)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property JOB_ADSYNC_ROOT_PATH() As String
Get
Return CType(Me("JOB_ADSYNC_ROOT_PATH"),String)
End Get
End Property
End Class
End Namespace

View File

@@ -11,9 +11,6 @@
<Setting Name="JOB_ADSYNC_ENABLED" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="JOB_ADSYNC_INTERVAL" Type="System.String" Scope="Application">
<Value Profile="(Default)">1,2,3,4,5,6,7,8,9,10</Value>
</Setting>
<Setting Name="DB_DATASOURCE" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
@@ -29,5 +26,11 @@
<Setting Name="JOB_INTERVAL" Type="System.Int64" Scope="Application">
<Value Profile="(Default)">120</Value>
</Setting>
<Setting Name="JOB_ADSYNC_INTERVAL" Type="System.Int64" Scope="Application">
<Value Profile="(Default)">120</Value>
</Setting>
<Setting Name="JOB_ADSYNC_ROOT_PATH" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@@ -33,6 +33,7 @@ Public Class WindowsService
End Sub
Protected Overrides Sub OnStop()
_jobRunner.Stop()
_logger.Info($"{My.Settings.SERVICE_NAME} is stopping.")
End Sub
End Class