Is it possible to send AMQP packets/telemetry to Azure Event Hub not using TLS encryption?
The reason I want to do this, is to see exactly what a non-encrypted AMQP packet looks like.
I have tried the following code (see amqpTransSetting.UseSslStreamSecurity = false, but it still encrypts the communication.
var amqpTransSetting = new AmqpTransportSettings();
amqpTransSetting.UseSslStreamSecurity = false;
var cs = @"Endpoint=sb://companyname-ns.servicebus.windows.net/;SharedAccessKeyName=EventHubPublisher;SharedAccessKey=84EHa5NNllnZBzH5ksogvNfhMWtIokdTdjxXXXXXXX=";
var builder = new ServiceBusConnectionStringBuilder(cs)
{
TransportType = TransportType.Amqp,
};
var client = EventHubClient.CreateFromConnectionString(builder.ToString(), "companyname-eh");
int sentCount = sendCount;
string infoText;
for (int i = 0; i < sendCount; i++)
{
try
{
if (MessageType.Text == "Fake Sensor")
{
infoText = "Sent using AMQP protocol";
}
else
{
infoText = "Sent using AMQP protocol";
}
Random rnd = new Random();
int intTemp = rnd.Next(15, 25);
int intHum = rnd.Next(50, 80);
var e = new Event
{
MessageType = MessageType.Text,
Temp = intTemp,
Humidity = intHum,
Location = Location.Text,
Room = Room.Text,
Info = infoText
};
var serializedString = JsonConvert.SerializeObject(e);
var data = new EventData(Encoding.UTF8.GetBytes(serializedString))
{
PartitionKey = rnd.Next(6).ToString()
};
// Set user properties if needed
data.Properties.Add("Type", "Telemetry_" + DateTime.Now.ToLongTimeString());
await client.SendAsync(data).ConfigureAwait(false);
}
catch (Exception exp)
{
Console.WriteLine("Error on send: " + exp.Message);
sentCount--;
}