V1.0
This commit is contained in:
31
MQ/Mq.cs
31
MQ/Mq.cs
@@ -23,7 +23,7 @@ namespace ARI.EAP.HOST.MQ
|
||||
{
|
||||
public class Mq
|
||||
{
|
||||
public readonly static ConnectionFactory connectionFactory;
|
||||
private readonly static ConnectionFactory connectionFactory;
|
||||
private IConnection conn;
|
||||
private IModel Channel;
|
||||
private EventingBasicConsumer consumer;
|
||||
@@ -119,7 +119,7 @@ namespace ARI.EAP.HOST.MQ
|
||||
consumer2 = new EventingBasicConsumer(Channel);
|
||||
consumer2.Received += MESRequest;
|
||||
Channel.BasicConsume(Configuration.conf.mQConnectionCfg.MES_Request_Queue, true, consumer2);
|
||||
Global.MF.MQConnectStatusSet(true);
|
||||
EquipmentStatus.MQstate = ConnectState.connected;
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
@@ -138,7 +138,7 @@ namespace ARI.EAP.HOST.MQ
|
||||
conn.Close();
|
||||
conn.Dispose();
|
||||
disposed = true;
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
LoggerService.MQLogger.Debug("MQ Connection Closed By User.");
|
||||
return true;
|
||||
}
|
||||
@@ -154,35 +154,26 @@ namespace ARI.EAP.HOST.MQ
|
||||
|
||||
void OnConnectionShutdown(object sender, ShutdownEventArgs ea)
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
if (this.disposed) return;
|
||||
LoggerService.MQLogger.Debug("MQ is shutdown,try to reconnect");
|
||||
if (CreatModel())
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(true);
|
||||
}
|
||||
CreatModel();
|
||||
}
|
||||
|
||||
void OnCallbackException(object sender, CallbackExceptionEventArgs e)
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
if (this.disposed) return;
|
||||
LoggerService.MQLogger.Debug("MQ throw an exception,try to reconnect");
|
||||
if (CreatModel())
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(true);
|
||||
}
|
||||
CreatModel();
|
||||
}
|
||||
|
||||
private void OnConnectionBlocked(object sender, ConnectionBlockedEventArgs e)
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
if (this.disposed) return;
|
||||
LoggerService.MQLogger.Debug("MQ is shutdown,try to reconnect");
|
||||
if (CreatModel())
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(true);
|
||||
}
|
||||
CreatModel();
|
||||
}
|
||||
|
||||
private void MESResponse(object sender, BasicDeliverEventArgs ea)
|
||||
@@ -219,7 +210,7 @@ namespace ARI.EAP.HOST.MQ
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
LoggerService.MQLogger.Debug("MQ is closed");
|
||||
return;
|
||||
}
|
||||
@@ -244,7 +235,7 @@ namespace ARI.EAP.HOST.MQ
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MF.MQConnectStatusSet(false);
|
||||
EquipmentStatus.MQstate = ConnectState.disconnected;
|
||||
LoggerService.MQLogger.Debug("MQ is closed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace ARI.EAP.HOST.MQ.body
|
||||
public string eventTimestamp;
|
||||
public string spoolingFlag;
|
||||
public string stateFlag;
|
||||
public string machineDataName;
|
||||
public Dictionary<string,string> machineData;
|
||||
|
||||
public MachineDataBody()
|
||||
|
||||
Reference in New Issue
Block a user