Put try-catch statement when trying to connect to the queue for the first time
This commit is contained in:
parent
30a3a05de0
commit
511c3080a6
|
@ -297,6 +297,8 @@ internal static class Program
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SubscribeToQueue(SalimaxAlarmState currentSalimaxState, String? s3Bucket)
|
private static void SubscribeToQueue(SalimaxAlarmState currentSalimaxState, String? s3Bucket)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_factory = new ConnectionFactory { HostName = VpnServerIp };
|
_factory = new ConnectionFactory { HostName = VpnServerIp };
|
||||||
_connection = _factory.CreateConnection();
|
_connection = _factory.CreateConnection();
|
||||||
|
@ -307,6 +309,11 @@ internal static class Program
|
||||||
|
|
||||||
_subscribedToQueue = true;
|
_subscribedToQueue = true;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("An error occurred while connecting to the RabbitMQ queue: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static IPAddress FindVpnIp()
|
private static IPAddress FindVpnIp()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue