67 lines
2.8 KiB
VB.net
67 lines
2.8 KiB
VB.net
Imports System.ServiceModel
|
|
Imports System.ServiceModel.Description
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Messaging.WCF
|
|
Imports ECM.JobRunner.Windows.Scheduler
|
|
Imports FxResources.System
|
|
|
|
Namespace WCF
|
|
|
|
Public Class JobRunner
|
|
Implements IJobRunner
|
|
|
|
Public Shared State As State
|
|
Public Shared LogConfig As LogConfig
|
|
Public Shared Database As MSSQLServer
|
|
Public Shared Scheduler As JobScheduler
|
|
|
|
''' <summary>
|
|
''' See: https://stackoverflow.com/questions/42327988/addserviceendpoint-throws-key-is-null
|
|
''' </summary>
|
|
''' <param name="Config"></param>
|
|
Public Shared Sub Configure(Config As ServiceConfiguration)
|
|
Dim oBaseAddress = Config.BaseAddresses.Item(0)
|
|
Dim oBinding = Binding.GetBinding()
|
|
Dim oAddress = New EndpointAddress(oBaseAddress)
|
|
Dim oDescription = ContractDescription.GetContract(GetType(IJobRunner), GetType(JobRunner))
|
|
Dim oEndpoint As New ServiceEndpoint(oDescription, oBinding, oAddress)
|
|
|
|
Config.AddServiceEndpoint(oEndpoint)
|
|
Config.Description.Behaviors.Add(New ServiceDebugBehavior With {
|
|
.IncludeExceptionDetailInFaults = True
|
|
})
|
|
End Sub
|
|
|
|
Public Function GetHeartbeat() As Date Implements IJobRunner.GetHeartbeat
|
|
Return Now
|
|
End Function
|
|
|
|
Public Function GetJobHistory() As GetJobStatus.GetJobStatusResponse Implements IJobRunner.GetJobStatus
|
|
Dim oMethod As New GetJobStatus.GetJobStatusMethod(LogConfig, Database, State, Scheduler)
|
|
Return oMethod.Run()
|
|
End Function
|
|
|
|
Public Function GetJobConfig() As GetJobConfig.GetJobConfigResponse Implements IJobRunner.GetJobConfig
|
|
Dim oMethod As New GetJobConfig.GetJobConfigMethod(LogConfig, Database, State)
|
|
Return oMethod.Run()
|
|
End Function
|
|
|
|
Public Function UpdateJob(pData As UpdateJob.UpdateJobRequest) As UpdateJob.UpdateJobResponse Implements IJobRunner.UpdateJob
|
|
Dim oMethod As New UpdateJob.UpdateJobMethod(LogConfig, Database, State, Scheduler)
|
|
Return oMethod.Run(pData)
|
|
End Function
|
|
|
|
Public Function UpdateProfile(pData As UpdateProfile.UpdateProfileRequest) As UpdateProfile.UpdateProfileResponse Implements IJobRunner.UpdateProfile
|
|
Dim oMethod As New UpdateProfile.UpdateProfileMethod(LogConfig, Database, State, Scheduler)
|
|
Return oMethod.Run(pData)
|
|
End Function
|
|
|
|
Public Function RunJob() As RunJob.RunJobResponse Implements IJobRunner.RunJob
|
|
'Dim oMethod As New RunJob.RunJobMethod(LogConfig, Database, State, Scheduler)
|
|
'Return oMethod.Run(pData)
|
|
End Function
|
|
End Class
|
|
|
|
End Namespace
|