- aggiunta stringa di connessione a Redis ufficio
- aggiunti stopwatch
This commit is contained in:
@@ -6,10 +6,12 @@ Imports StackExchange.Redis
|
||||
|
||||
Module MainModule
|
||||
|
||||
Private m_bDebug As Boolean = True
|
||||
Private m_bDebug As Boolean = False
|
||||
|
||||
Private m_ExecProcessManager As ExecProcessManager
|
||||
|
||||
Private m_stopWatch As New Stopwatch()
|
||||
|
||||
' Riferimento al gestore del server Redis
|
||||
Private m_RedisManager As RedisManager
|
||||
Friend ReadOnly Property RedisManager As RedisManager
|
||||
@@ -29,12 +31,15 @@ Module MainModule
|
||||
m_ExecProcessManager.StartExecutionThread()
|
||||
AddHandler m_ExecProcessManager.m_AnswerReceived, AddressOf ExecProcessManager_AnswerReceived
|
||||
End If
|
||||
m_RedisManager = New RedisManager("localhost", 1)
|
||||
Dim sConnection As String = "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true"
|
||||
m_RedisManager = New RedisManager(sConnection, 1)
|
||||
m_RedisManager.SubscribeChannel("EgwEngineInput", AddressOf EgwEngineInputHandler)
|
||||
m_RedisManager.SubscribeChannel("EgwEngineOutput", AddressOf EgwEngineOutputHandler)
|
||||
|
||||
'Dim sRettad As String = System.Console.ReadLine()
|
||||
|
||||
' funzionamento simulato
|
||||
If m_bDebug Then
|
||||
m_RedisManager.SubscribeChannel("EgwEngineOutput", AddressOf EgwEngineOutputHandler)
|
||||
Dim sRead As String = System.Console.ReadLine()
|
||||
While Not String.IsNullOrWhiteSpace(sRead)
|
||||
' passo dati per esecuzione
|
||||
@@ -53,10 +58,19 @@ Module MainModule
|
||||
|
||||
Private Sub ExecProcessManager_AnswerReceived(Answer As ProcessArgsResult)
|
||||
m_RedisManager.Subscriber.Publish(OutputChn, JsonConvert.SerializeObject(Answer))
|
||||
m_stopWatch.Stop()
|
||||
' Get the elapsed time as a TimeSpan value.
|
||||
Dim ts As TimeSpan = m_stopWatch.Elapsed
|
||||
|
||||
' Format and display the TimeSpan value.
|
||||
Dim elapsedTime As String = String.Format("{0:N3}", ts.TotalMilliseconds)
|
||||
System.Console.WriteLine("Risposto in " + elapsedTime)
|
||||
End Sub
|
||||
|
||||
Private Sub EgwEngineInputHandler(RedisChannel As RedisChannel, RedisValue As RedisValue)
|
||||
System.Console.WriteLine("Ricevuto valore " & RedisValue.ToString() & " dal canale " & RedisChannel.ToString())
|
||||
'System.Console.WriteLine("Ricevuto valore " & RedisValue.ToString() & " dal canale " & RedisChannel.ToString())
|
||||
System.Console.WriteLine("Ricevuto valore dal canale " & RedisChannel.ToString())
|
||||
m_stopWatch.Restart()
|
||||
Dim Request As ProcessArgs = JsonConvert.DeserializeObject(Of ProcessArgs)(RedisValue)
|
||||
m_ExecProcessManager.ArgumentsEnqueue(Request)
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user