Add Heartbeat Function to Service, Add Timer to ClientSuite Service Startup check

This commit is contained in:
Jonathan Jenne
2019-02-18 17:06:41 +01:00
parent bc7605bdcf
commit 4229682da0
24 changed files with 259 additions and 85 deletions

View File

@@ -18,6 +18,32 @@ Public Class ClassService
_Logger = _LogConfig.GetLogger()
End Sub
Public Function TestConnection() As ConnectionTestResult
Return TestConnection(My.Config.ServiceConnection)
End Function
Public Function TestConnection(EndpointURL As String) As ConnectionTestResult
Try
Dim oChannelFactory = GetChannelFactory(EndpointURL)
Dim oChannel = oChannelFactory.CreateChannel()
oChannel.OperationTimeout = New TimeSpan(0, 0, ClassConstants.SERVICE_OPEN_TIMEOUT)
oChannel.Open()
oChannel.Close()
Return ConnectionTestResult.Successful
Catch ex As EndpointNotFoundException
_Logger.Error(ex)
Return ConnectionTestResult.NotFound
Catch ex As Exception
_Logger.Error(ex)
Return ConnectionTestResult.Unknown
End Try
End Function
Public Async Function TestConnectionAsync() As Task(Of ConnectionTestResult)
Return Await TestConnectionAsync(My.Config.ServiceConnection)
End Function
Public Async Function TestConnectionAsync(EndpointURL As String) As Task(Of ConnectionTestResult)
Return Await Task.Factory.StartNew(Function()
Try