EgwMultiEngineManager 3.1.1.1:
- aggiunta funzione Copy a Statistics - aggiunta gestione statistiche - aggiunta gestione eccezioni su subscribe e publish del Redis
This commit is contained in:
@@ -28,5 +28,5 @@ Imports System.Runtime.InteropServices
|
||||
' Revision
|
||||
'
|
||||
|
||||
<Assembly: AssemblyVersion("2.7.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.7.12.2")>
|
||||
<Assembly: AssemblyVersion("3.1.1.1")>
|
||||
<Assembly: AssemblyFileVersion("3.1.1.1")>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||
<Copyright>Copyright © 2020-2025 by Egalware s.r.l.</Copyright>
|
||||
<AssemblyVersion>2.7.12.1</AssemblyVersion>
|
||||
<FileVersion>2.7.12.1</FileVersion>
|
||||
<AssemblyVersion>3.1.1.1</AssemblyVersion>
|
||||
<FileVersion>3.1.1.1</FileVersion>
|
||||
<Company>Egalware s.r.l.</Company>
|
||||
<Version>2.7.12.1</Version>
|
||||
<Version>3.1.1.1</Version>
|
||||
<Authors>Emmanuele Sassi</Authors>
|
||||
<Description>Specifiche comunicazione con EgwMultiEngineManager</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -72,10 +72,26 @@
|
||||
m_nQuestionInQueue = nQuestionInQueue
|
||||
End Sub
|
||||
|
||||
Sub New(Statistics As Statistics)
|
||||
m_nEngineRunningQty = Statistics.nEngineRunningQty
|
||||
m_nEngineProcessingQty = Statistics.nEngineProcessingQty
|
||||
m_dMinProcessingTime = Statistics.dMinProcessingTime
|
||||
m_dMidProcessingTime = Statistics.dMidProcessingTime
|
||||
m_dMaxProcessingTime = Statistics.dMaxProcessingTime
|
||||
m_nLastMinAnswer = Statistics.nLastMinAnswer
|
||||
m_nLast5MinAnswer = Statistics.nLast5MinAnswer
|
||||
m_nLastHourAnswer = Statistics.nLastHourAnswer
|
||||
m_nQuestionInQueue = Statistics.nQuestionInQueue
|
||||
End Sub
|
||||
|
||||
Public Sub SetProcessingTimes(dMinProcessingTime As Double, dMidProcessingTime As Double, dMaxProcessingTime As Double)
|
||||
m_dMinProcessingTime = dMinProcessingTime
|
||||
m_dMidProcessingTime = dMidProcessingTime
|
||||
m_dMaxProcessingTime = dMaxProcessingTime
|
||||
End Sub
|
||||
|
||||
Public Function Copy() As Statistics
|
||||
Return New Statistics(Me)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -2,6 +2,7 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Windows.Threading
|
||||
Imports EgwMultiEngineManager.Data
|
||||
Imports EgwMultiEngineManager.Tray.ExecEnvironmentManager
|
||||
|
||||
Class Application
|
||||
|
||||
@@ -113,9 +114,53 @@ Class Application
|
||||
|
||||
Private Sub StatisticsTimer_Tick()
|
||||
If True Then
|
||||
Dim sTooltip As String = "RPTQ15H" & Environment.NewLine
|
||||
Dim sEnvironment As String = ""
|
||||
For nGroupType = EnvironmentCommunicationTypes.REDIS To EnvironmentCommunicationTypes.REST
|
||||
Dim nGroupIndex As Integer = 1
|
||||
Dim sGroupName As String = If(nGroupType = EnvironmentCommunicationTypes.REST, S_RESTEXECGROUP, S_EXECGROUP) & nGroupIndex.ToString()
|
||||
While GetMainPrivateProfileString(sGroupName, K_ENVIRONMENT, "", sEnvironment) > 0
|
||||
Dim CurrStatistics As Statistics = m_MainWindowVM.GetValueFromKeyInStatisticsList(sGroupName)
|
||||
If Not IsNothing(CurrStatistics) Then
|
||||
sTooltip &= If(nGroupType = EnvironmentCommunicationTypes.REST, "R", "G") & nGroupIndex.ToString() &
|
||||
CurrStatistics.nEngineRunningQty &
|
||||
CurrStatistics.nEngineProcessingQty &
|
||||
CurrStatistics.dMidProcessingTime.ToString("N1") &
|
||||
CurrStatistics.nQuestionInQueue &
|
||||
CurrStatistics.nLastMinAnswer &
|
||||
CurrStatistics.nLast5MinAnswer &
|
||||
CurrStatistics.nLastHourAnswer & Environment.NewLine
|
||||
'"MinT " & e.dMinProcessingTime.ToString("N1") & Environment.NewLine &
|
||||
'"MaxT " & e.nQuestionInQueue.ToString("N1") & Environment.NewLine &
|
||||
End If
|
||||
nGroupIndex += 1
|
||||
sGroupName = If(nGroupType = EnvironmentCommunicationTypes.REST, S_RESTEXECGROUP, S_EXECGROUP) & nGroupIndex.ToString()
|
||||
End While
|
||||
Next
|
||||
sTooltip = sTooltip.Substring(0, Math.Min(60, sTooltip.Length))
|
||||
m_NotifyIcon.Text = sTooltip
|
||||
Return
|
||||
Dim ExecEnvironment As EXECENVIRONMENTS = ExecEnvironmentManager.GetExecEnvironmentFromString(sEnvironment)
|
||||
If ExecEnvironment <> EXECENVIRONMENTS.NULL Then
|
||||
Dim CurrStatistics As Statistics = m_MainWindowVM.GetValueFromKeyInStatisticsList(ExecEnvironment)
|
||||
If Not IsNothing(CurrStatistics) Then
|
||||
Dim Tooltip As String = "QRun " & CurrStatistics.nEngineRunningQty & Environment.NewLine &
|
||||
"QProc " & CurrStatistics.nEngineProcessingQty & Environment.NewLine &
|
||||
"MidT " & CurrStatistics.dMidProcessingTime.ToString("N1") & Environment.NewLine &
|
||||
"Que " & CurrStatistics.nQuestionInQueue & Environment.NewLine &
|
||||
"1MAns " & CurrStatistics.nLastMinAnswer & Environment.NewLine &
|
||||
"5MAns " & CurrStatistics.nLast5MinAnswer & Environment.NewLine &
|
||||
"HAns " & CurrStatistics.nLastHourAnswer
|
||||
'"MinT " & e.dMinProcessingTime.ToString("N1") & Environment.NewLine &
|
||||
'"MaxT " & e.nQuestionInQueue.ToString("N1") & Environment.NewLine &
|
||||
Tooltip = Tooltip.Substring(0, Math.Min(60, Tooltip.Length))
|
||||
m_NotifyIcon.Text = Tooltip
|
||||
End If
|
||||
End If
|
||||
ElseIf False Then
|
||||
Dim sEnvironment As String = ""
|
||||
GetMainPrivateProfileString(S_EXECGROUP & 1.ToString(), K_ENVIRONMENT, "", sEnvironment)
|
||||
Dim ExecEnvironment As EXECENVIRONMENTS = m_MainWindowVM.GetExecEnvironmentFromString(sEnvironment)
|
||||
Dim ExecEnvironment As EXECENVIRONMENTS = ExecEnvironmentManager.GetExecEnvironmentFromString(sEnvironment)
|
||||
If ExecEnvironment <> EXECENVIRONMENTS.NULL Then
|
||||
Dim CurrStatistics As Statistics = m_MainWindowVM.GetValueFromKeyInStatisticsList(ExecEnvironment)
|
||||
If Not IsNothing(CurrStatistics) Then
|
||||
@@ -133,7 +178,7 @@ Class Application
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Dim KeyList As List(Of EXECENVIRONMENTS) = m_MainWindowVM.GetStatisticsListKeyCollection()
|
||||
Dim KeyList As List(Of String) = m_MainWindowVM.GetStatisticsListKeyCollection()
|
||||
Dim StatisticsList As New List(Of Statistics)
|
||||
Dim sQRun As String = "QRun__"
|
||||
Dim sQProc As String = "QProc_"
|
||||
|
||||
@@ -48,26 +48,26 @@ Public Class MainWindowVM
|
||||
End Property
|
||||
|
||||
Private m_Lock_StatisticsList As New Object
|
||||
Private m_StatisticsList As New Dictionary(Of EXECENVIRONMENTS, Statistics)
|
||||
Friend Function GetValueFromKeyInStatisticsList(ExecEnvironment As EXECENVIRONMENTS) As Statistics
|
||||
Private m_StatisticsList As New Dictionary(Of String, Statistics)
|
||||
Friend Function GetValueFromKeyInStatisticsList(sGroupName As String) As Statistics
|
||||
SyncLock m_Lock_StatisticsList
|
||||
If m_StatisticsList.ContainsKey(ExecEnvironment) Then
|
||||
Return m_StatisticsList(ExecEnvironment)
|
||||
If m_StatisticsList.ContainsKey(sGroupName) Then
|
||||
Return m_StatisticsList(sGroupName).Copy()
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
End SyncLock
|
||||
End Function
|
||||
Friend Sub SetValueToKeyInStatisticsList(ExecEnvironment As EXECENVIRONMENTS, Statistics As Statistics)
|
||||
Friend Sub SetValueToKeyInStatisticsList(sGroupName As String, Statistics As Statistics)
|
||||
SyncLock m_Lock_StatisticsList
|
||||
If m_StatisticsList.ContainsKey(ExecEnvironment) Then
|
||||
m_StatisticsList(ExecEnvironment) = Statistics
|
||||
If m_StatisticsList.ContainsKey(sGroupName) Then
|
||||
m_StatisticsList(sGroupName) = Statistics
|
||||
Else
|
||||
m_StatisticsList.Add(ExecEnvironment, Statistics)
|
||||
m_StatisticsList.Add(sGroupName, Statistics)
|
||||
End If
|
||||
End SyncLock
|
||||
End Sub
|
||||
Friend Function GetStatisticsListKeyCollection() As List(Of EXECENVIRONMENTS)
|
||||
Friend Function GetStatisticsListKeyCollection() As List(Of String)
|
||||
SyncLock m_Lock_StatisticsList
|
||||
Return m_StatisticsList.Keys.ToList()
|
||||
End SyncLock
|
||||
@@ -164,6 +164,7 @@ Public Class MainWindowVM
|
||||
While ExecEnvironmentManager.CreateExecEnvironmentManager(ExecEnvironmentManager.EnvironmentCommunicationTypes.REDIS, nGroupIndex, NewExecProcessManager)
|
||||
If Not IsNothing(NewExecProcessManager) Then
|
||||
m_ExecEnvironmentList.Add(NewExecProcessManager)
|
||||
AddHandler NewExecProcessManager.StatisticUpdate, AddressOf NewExecProcessManager_StatisticUpdate
|
||||
End If
|
||||
NewExecProcessManager = Nothing
|
||||
nGroupIndex += 1
|
||||
@@ -174,6 +175,7 @@ Public Class MainWindowVM
|
||||
While ExecEnvironmentManager.CreateExecEnvironmentManager(ExecEnvironmentManager.EnvironmentCommunicationTypes.REST, nGroupIndex, NewExecProcessManager)
|
||||
If Not IsNothing(NewExecProcessManager) Then
|
||||
m_ExecEnvironmentList.Add(NewExecProcessManager)
|
||||
AddHandler NewExecProcessManager.StatisticUpdate, AddressOf NewExecProcessManager_StatisticUpdate
|
||||
End If
|
||||
NewExecProcessManager = Nothing
|
||||
nGroupIndex += 1
|
||||
@@ -181,6 +183,10 @@ Public Class MainWindowVM
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub NewExecProcessManager_StatisticUpdate(sGroupName As String, Statistics As Statistics)
|
||||
SetValueToKeyInStatisticsList(sGroupName, Statistics)
|
||||
End Sub
|
||||
|
||||
Private Sub ManageInstance()
|
||||
Dim bCreated As Boolean
|
||||
Try
|
||||
|
||||
@@ -52,5 +52,5 @@ Imports System.Windows
|
||||
' Revision
|
||||
'
|
||||
|
||||
<Assembly: AssemblyVersion("2.7.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.7.12.2")>
|
||||
<Assembly: AssemblyVersion("3.1.1.1")>
|
||||
<Assembly: AssemblyFileVersion("3.1.1.1")>
|
||||
|
||||
@@ -19,7 +19,7 @@ Public Class ExecEnvironmentManager
|
||||
REST = 2
|
||||
End Enum
|
||||
|
||||
Public Event StatisticUpdate(Environment As EXECENVIRONMENTS, Statistics As Statistics)
|
||||
Public Event StatisticUpdate(sGroupName As String, Statistics As Statistics)
|
||||
|
||||
Private ConstChnName_EgwEngineInput As String = "EgwEngineInput"
|
||||
Private ConstChnName_EgwEngineOutput As String = "EgwEngineOutput"
|
||||
@@ -56,6 +56,13 @@ Public Class ExecEnvironmentManager
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_sGroupName As String = String.Empty
|
||||
Friend ReadOnly Property GroupName As String
|
||||
Get
|
||||
Return m_sGroupName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared m_RedisManager As RedisManager
|
||||
Friend Shared Sub SetRedisManager(RedisManager As RedisManager)
|
||||
m_RedisManager = RedisManager
|
||||
@@ -96,6 +103,7 @@ Public Class ExecEnvironmentManager
|
||||
End Property
|
||||
|
||||
Private m_chnEgwEngineOutput As RedisChannel
|
||||
Private m_chnEgwEngineInput As RedisChannel
|
||||
Private m_chnEgwStatistics As RedisChannel
|
||||
|
||||
' statistics
|
||||
@@ -116,58 +124,49 @@ Public Class ExecEnvironmentManager
|
||||
Dim sPipeLuaFile As String = ""
|
||||
Dim nMaxCamInstances As Integer = 0
|
||||
Dim bDebug As Boolean = False
|
||||
Dim sGroupTitle As String = If(nType = EnvironmentCommunicationTypes.REST, S_RESTEXECGROUP, S_EXECGROUP)
|
||||
If GetMainPrivateProfileString(sGroupTitle & nGroupIndex.ToString(), K_ENVIRONMENT, "", sEnvironment) > 0 AndAlso
|
||||
GetMainPrivateProfileString(sGroupTitle & nGroupIndex.ToString(), K_PIPELUAFILE, "", sPipeLuaFile) AndAlso
|
||||
GetMainPrivateProfileString(sGroupTitle & nGroupIndex.ToString(), K_MAXCAMINSTANCES, "", nMaxCamInstances) Then
|
||||
Dim sGroupName As String = If(nType = EnvironmentCommunicationTypes.REST, S_RESTEXECGROUP, S_EXECGROUP) & nGroupIndex.ToString()
|
||||
If GetMainPrivateProfileString(sGroupName, K_ENVIRONMENT, "", sEnvironment) > 0 AndAlso
|
||||
GetMainPrivateProfileString(sGroupName, K_PIPELUAFILE, "", sPipeLuaFile) AndAlso
|
||||
GetMainPrivateProfileString(sGroupName, K_MAXCAMINSTANCES, "", nMaxCamInstances) Then
|
||||
EgtOutLog(If(nType = EnvironmentCommunicationTypes.REST, "REST", "") & "Group" & nGroupIndex.ToString())
|
||||
EgtOutLog("Environment = " & sEnvironment)
|
||||
EgtOutLog("PipeLuaFile = " & sPipeLuaFile)
|
||||
EgtOutLog("MaxCAMInstances = " & nMaxCamInstances)
|
||||
If nMaxCamInstances <= 0 Then
|
||||
EgtOutLog("No Cam instances assigned!")
|
||||
EgtOutLog(String.Format(sGroupTitle & "{0} will not be created!", nGroupIndex.ToString()))
|
||||
EgtOutLog(String.Format(sGroupName & " will not be created!"))
|
||||
nGroupIndex += 1
|
||||
Return True
|
||||
End If
|
||||
Dim ExecEnvironment As EXECENVIRONMENTS = EXECENVIRONMENTS.NULL
|
||||
Select Case sEnvironment
|
||||
Case "WINDOW"
|
||||
ExecEnvironment = EXECENVIRONMENTS.WINDOW
|
||||
Case "BEAM"
|
||||
ExecEnvironment = EXECENVIRONMENTS.BEAM
|
||||
Case "WALL"
|
||||
ExecEnvironment = EXECENVIRONMENTS.WALL
|
||||
Case "CABINET"
|
||||
ExecEnvironment = EXECENVIRONMENTS.CABINET
|
||||
End Select
|
||||
Dim ExecEnvironment As EXECENVIRONMENTS = GetExecEnvironmentFromString(sEnvironment)
|
||||
If ExecEnvironment = EXECENVIRONMENTS.NULL Then
|
||||
EgtOutLog("No ExecEnvironment assigned!")
|
||||
EgtOutLog(String.Format(sGroupTitle & "{0} will not be created!", nGroupIndex.ToString()))
|
||||
EgtOutLog(String.Format(sGroupName & " will not be created!"))
|
||||
nGroupIndex += 1
|
||||
Return True
|
||||
End If
|
||||
Dim sPipeLuaPath As String = Map.refMainWindowVM.sDataRoot & "\" & sPipeLuaDirName & "\" & sPipeLuaFile
|
||||
If Not File.Exists(sPipeLuaPath) Then
|
||||
EgtOutLog("Lua file not assigned or not found!")
|
||||
EgtOutLog(String.Format(sGroupTitle & "{0} will not be created!", nGroupIndex.ToString()))
|
||||
EgtOutLog(String.Format(sGroupName & " will not be created!"))
|
||||
nGroupIndex += 1
|
||||
Return True
|
||||
End If
|
||||
Dim sProcessArguments As String = """" & sPipeLuaPath & """ " & """" & sConnection & """"
|
||||
' leggo se modalita' debug
|
||||
Dim nDebug As Integer = GetMainPrivateProfileInt(sGroupTitle & nGroupIndex.ToString(), K_DEBUG, 0)
|
||||
Dim nDebug As Integer = GetMainPrivateProfileInt(sGroupName, K_DEBUG, 0)
|
||||
bDebug = (nDebug = 1)
|
||||
NewExecEnvironmentManager = New ExecEnvironmentManager(nType, ExecEnvironment, nGroupIndex, sCamExePath, sProcessArguments, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, bDebug)
|
||||
EgtOutLog(String.Format(sGroupTitle & "{0} created", nGroupIndex.ToString()))
|
||||
NewExecEnvironmentManager = New ExecEnvironmentManager(nType, sGroupName, ExecEnvironment, nGroupIndex, sCamExePath, sProcessArguments, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, bDebug)
|
||||
EgtOutLog(String.Format(sGroupName & " created"))
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Sub New(nType As EnvironmentCommunicationTypes, nEnvironment As EXECENVIRONMENTS, nGroupId As Integer, sProcessFileName As String, sProcessArguments As String, nMaxCamInstances As Integer, bReturnMode As ExecProcessManager.ReturnModes, bDebug As Boolean)
|
||||
Sub New(nType As EnvironmentCommunicationTypes, sGroupName As String, nEnvironment As EXECENVIRONMENTS, nGroupId As Integer, sProcessFileName As String, sProcessArguments As String, nMaxCamInstances As Integer, bReturnMode As ExecProcessManager.ReturnModes, bDebug As Boolean)
|
||||
m_EnvironmentCommunicationType = nType
|
||||
m_sGroupName = sGroupName
|
||||
Select Case m_EnvironmentCommunicationType
|
||||
Case EnvironmentCommunicationTypes.REDIS
|
||||
m_ExecEnvironment = nEnvironment
|
||||
@@ -192,13 +191,15 @@ Public Class ExecEnvironmentManager
|
||||
ConstChnName_EgwStatistics = sStatisticsChannelName.Replace("%%", "").Replace("@@", sIpAddress)
|
||||
ConstChnName_EgwDevStatistics = sStatisticsChannelName.Replace("%%", "Dev").Replace("@@", sIpAddress)
|
||||
m_chnEgwEngineOutput = New RedisChannel(ChnName_EgwEngineOutput, RedisChannel.PatternMode.Auto)
|
||||
m_chnEgwEngineInput = New RedisChannel(ChnName_EgwEngineInput, RedisChannel.PatternMode.Auto)
|
||||
m_chnEgwStatistics = New RedisChannel(ChnName_EgwStatistics, RedisChannel.PatternMode.Auto)
|
||||
m_RedisManager.SubscribeChannel(ChnName_EgwEngineInput, AddressOf EgwEngineInputHandler)
|
||||
m_RedisManager.SubscribeChannel(m_chnEgwEngineInput, AddressOf EgwEngineInputHandler)
|
||||
Case EnvironmentCommunicationTypes.REST
|
||||
m_ExecEnvironment = nEnvironment
|
||||
m_ExecProcessManager = New ExecProcessManager(nGroupId + 1000, nEnvironment, sProcessFileName, sProcessArguments, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, bDebug)
|
||||
m_chnEgwStatistics = New RedisChannel(ChnName_EgwStatistics, RedisChannel.PatternMode.Auto)
|
||||
AddHandler m_ExecProcessManager.m_AnswerReceived, AddressOf ExecProcessManager_AnswerReceived
|
||||
'AddHandler m_ExecProcessManager.m_Statistics, AddressOf ExecProcessManager_Statistics
|
||||
AddHandler m_ExecProcessManager.m_Statistics, AddressOf ExecProcessManager_Statistics
|
||||
m_ExecProcessManager.StartExecutionThread()
|
||||
'm_Client = New RestClient("https://office.egalware.com/lux/srv/api")
|
||||
m_Client = New RestClient("https://iis01.egalware.com/lux/srv/api")
|
||||
@@ -209,6 +210,21 @@ Public Class ExecEnvironmentManager
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Friend Shared Function GetExecEnvironmentFromString(sEnvironment As String) As EXECENVIRONMENTS
|
||||
Select Case sEnvironment
|
||||
Case "WINDOW"
|
||||
Return EXECENVIRONMENTS.WINDOW
|
||||
Case "BEAM"
|
||||
Return EXECENVIRONMENTS.BEAM
|
||||
Case "WALL"
|
||||
Return EXECENVIRONMENTS.WALL
|
||||
Case "CABINET"
|
||||
Return EXECENVIRONMENTS.CABINET
|
||||
Case Else
|
||||
Return EXECENVIRONMENTS.NULL
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Async Sub RestTimer_Tick(sender As Object, e As EventArgs)
|
||||
Dim nProcessedQuestion As Integer = 0
|
||||
While m_ExecProcessManager.nFreeProcesses > 0 And m_ExecProcessManager.ArgumentsQueueCount < m_ExecProcessManager.nFreeProcesses And nProcessedQuestion < m_ExecProcessManager.nRunningProcesses
|
||||
@@ -253,7 +269,7 @@ Public Class ExecEnvironmentManager
|
||||
End If
|
||||
End If
|
||||
EgtOutLog(DateTime.Now.ToString("HH:mm:ss.fff") & " Environment=" & m_ExecEnvironment & " Channel=" & chnEgwEngineOutput.ToString() & " Answer Id=" & Answer.nId)
|
||||
m_RedisManager.Subscriber.Publish(chnEgwEngineOutput, JsonConvert.SerializeObject(Answer))
|
||||
m_RedisManager.Publish(chnEgwEngineOutput, JsonConvert.SerializeObject(Answer))
|
||||
m_stopWatch.Stop()
|
||||
' Format and display the TimeSpan value.
|
||||
Dim elapsedTime As String = String.Format("{0:N3}", m_stopWatch.Elapsed.TotalMilliseconds)
|
||||
@@ -278,6 +294,8 @@ Public Class ExecEnvironmentManager
|
||||
request = New RestRequest("Prod/jobreturn", Method.Post)
|
||||
Case 2
|
||||
request = New RestRequest("Prod/jobreturn", Method.Post)
|
||||
Case 3
|
||||
request = New RestRequest("Prod/jobreturn", Method.Post)
|
||||
End Select
|
||||
End Select
|
||||
'request.AddBody(JsonConvert.SerializeObject(Answer))
|
||||
@@ -312,9 +330,9 @@ Public Class ExecEnvironmentManager
|
||||
Private Sub ExecProcessManager_Statistics(e As Statistics)
|
||||
Dim CurrManagerStatistics As Statistics = e
|
||||
CurrManagerStatistics.SetProcessingTimes(m_dMinProcessingTime, m_dMidProcessingTime, m_dMaxProcessingTime)
|
||||
RaiseEvent StatisticUpdate(m_ExecEnvironment, CurrManagerStatistics)
|
||||
RaiseEvent StatisticUpdate(m_sGroupName, CurrManagerStatistics)
|
||||
If Not IsNothing(m_chnEgwStatistics) Then
|
||||
m_RedisManager.Subscriber.Publish(m_chnEgwStatistics, JsonConvert.SerializeObject(CurrManagerStatistics))
|
||||
m_RedisManager.Publish(m_chnEgwStatistics, JsonConvert.SerializeObject(CurrManagerStatistics))
|
||||
End If
|
||||
m_nProcessingQty = 0
|
||||
m_dMinProcessingTime = 100000
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports System
|
||||
Imports EgtDotNETBasis
|
||||
Imports StackExchange.Redis
|
||||
|
||||
Public Class RedisManager
|
||||
@@ -36,10 +36,25 @@ Public Class RedisManager
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Friend Sub SubscribeChannel(sName As String, Handler As Action(Of RedisChannel, RedisValue))
|
||||
Dim InputChn As New RedisChannel(sName, RedisChannel.PatternMode.Auto)
|
||||
Subscriber.Subscribe(InputChn, Handler)
|
||||
End Sub
|
||||
Friend Function SubscribeChannel(channel As RedisChannel, handler As Action(Of RedisChannel, RedisValue)) As Boolean
|
||||
Try
|
||||
Subscriber.Subscribe(channel, handler)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
EgtOutLog(String.Format("Errore! Errore nella sottoscrizione Redis al canale {0}!", channel) & Environment.NewLine & ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Friend Function Publish(channel As RedisChannel, message As RedisValue) As Boolean
|
||||
Try
|
||||
Subscriber.Publish(channel, message)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
EgtOutLog(String.Format("Errore! Errore nella pubblicazione Redis sul canale {0} del messaggio {1}!", channel, message) & Environment.NewLine & ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Protected Overridable Sub Dispose(disposing As Boolean)
|
||||
If Not disposedValue Then
|
||||
|
||||
Reference in New Issue
Block a user