Add Heartbeat Function to Service, Add Timer to ClientSuite Service Startup check
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user