A small memory footprint AMQP implimentation

Dependents:   iothub_client_sample_amqp remote_monitoring simplesample_amqp

Revision:
13:9abd748f4e78
Parent:
12:b30dacf113f2
Child:
16:22a72cf8e416
--- a/message_sender.c	Thu Oct 20 17:07:44 2016 -0700
+++ b/message_sender.c	Wed Nov 16 21:38:05 2016 -0800
@@ -180,6 +180,7 @@
         AMQP_VALUE application_properties_value;
         AMQP_VALUE body_amqp_value = NULL;
         size_t body_data_count = 0;
+        AMQP_VALUE msg_annotations = NULL;
 
         message_get_header(message, &header);
         header_amqp_value = amqpvalue_create_header(header);
@@ -189,6 +190,14 @@
             total_encoded_size += encoded_size;
         }
 
+        // message annotations
+        if ((message_get_message_annotations(message, &msg_annotations) == 0) &&
+            (msg_annotations != NULL))
+        {
+            amqpvalue_get_encoded_size(msg_annotations, &encoded_size);
+            total_encoded_size += encoded_size;
+        }
+
         // properties
         message_get_properties(message, &properties);
         properties_amqp_value = amqpvalue_create_properties(properties);
@@ -305,6 +314,16 @@
                 log_message_chunk(message_sender_instance, "Header:", header_amqp_value);
             }
 
+            if ((result == SEND_ONE_MESSAGE_OK) && (msg_annotations != NULL))
+            {
+                if (amqpvalue_encode(msg_annotations, encode_bytes, &payload) != 0)
+                {
+                    result = SEND_ONE_MESSAGE_ERROR;
+                }
+
+                log_message_chunk(message_sender_instance, "Message Annotations:", msg_annotations);
+            }
+
             if ((result == SEND_ONE_MESSAGE_OK) && (properties != NULL))
             {
                 if (amqpvalue_encode(properties_amqp_value, encode_bytes, &payload) != 0)