Skip to content

Commit

Permalink
Merged PR 928443: Fix for EdgeAgent using MQTT
Browse files Browse the repository at this point in the history
When I changed EdgeAgent to use MQTT to connect to IoTHub, the agent threw an exception. Turns out it was a log line check making an assumption that only AMQP or AMQPWS would be used.
  • Loading branch information
dsajanice committed Jun 28, 2018
1 parent eeac6d6 commit 2d6824b
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,15 @@ enum EventIds
RetryingDeviceClientConnection,
DeviceClientSetupFailed
}

static string TransportName(TransportType type)
{
Preconditions.CheckArgument(type == TransportType.Amqp_Tcp_Only || type == TransportType.Amqp_WebSocket_Only);
return type == TransportType.Amqp_Tcp_Only ? "AMQP" : "AMQP over WebSocket";
}


public static void AttemptingConnectionWithTransport(TransportType transport)
{
Log.LogInformation((int)EventIds.AttemptingConnect, $"Edge agent attempting to connect to IoT Hub via {TransportName(transport)}...");
Log.LogInformation((int)EventIds.AttemptingConnect, $"Edge agent attempting to connect to IoT Hub via {transport.ToString()}...");
}

public static void ConnectedWithTransport(TransportType transport)
{
Log.LogInformation((int)EventIds.Connected, $"Edge agent connected to IoT Hub via {TransportName(transport)}.");
Log.LogInformation((int)EventIds.Connected, $"Edge agent connected to IoT Hub via {transport.ToString()}.");
}

public static void DeviceClientCreated()
Expand Down

0 comments on commit 2d6824b

Please sign in to comment.