Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Remove filter from message printing #310

Merged
merged 2 commits into from
Jun 22, 2017
Merged

Conversation

DBojsen
Copy link
Contributor

@DBojsen DBojsen commented Jun 16, 2017

When using the printer module to debug solutions it doesn't make sence that only messages coming from "Sensor" is printed.

When using the printer module to debug solutions it doesn't make sence that only messages coming from "Sensor" is printed.
{
Console.WriteLine("Printer Module received message from Sensor. Content: " + System.Text.Encoding.UTF8.GetString(received_message.Content, 0, received_message.Content.Length));
}
Console.WriteLine("Printer Module received message from " + received_message.Properties["source"] + ". Content: " + System.Text.Encoding.UTF8.GetString(received_message.Content, 0, received_message.Content.Length));
Copy link
Contributor

@aribeironovaes aribeironovaes Jun 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console.WriteLine("Printer Module received message from " + received_message.Properties["source"] + ". Content: " + System.Text.Encoding.UTF8.GetString(received_message.Content, 0, received_message.Content.Length)); [](start = 12, length = 215)

I don't think "source" property is added automatically. So, on this case you should print the Content separated from the properties.

So, please, do something like this:
if (received_message != null)
{
string messageData = System.Text.Encoding.UTF8.GetString(received_message.Content, 0, received_message.Content.Length);
Console.WriteLine("\t{0}> Received message: {1}", DateTime.Now.ToLocalTime(), messageData);

                    int propCount = 0;
                    foreach (var prop in received_message.Properties)
                    {
                        Console.WriteLine("\t\tProperty[{0}> Key={1} : Value={2}", propCount++, prop.Key, prop.Value);
                    } #Closed

@aribeironovaes
Copy link
Contributor

aribeironovaes commented Jun 16, 2017

:shipit:

@az-iot-builder-01 az-iot-builder-01 merged commit 9c75156 into Azure:master Jun 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants