public static ClientMessage DecodeMessage()

in src/Proton.Client/Client/Implementation/ClientMessageSupport.cs [167:220]


      public static ClientMessage<object> DecodeMessage(IDecoder decoder, IDecoderState decoderState,
                                                        IProtonBuffer buffer, Action<DeliveryAnnotations> daConsumer)
      {

         ClientMessage<object> message = new();

         ISection section;

         while (buffer.IsReadable)
         {
            try
            {
               section = (ISection)decoder.ReadObject(buffer, decoderState);
            }
            catch (Exception e)
            {
               throw ClientExceptionSupport.CreateNonFatalOrPassthrough(e);
            }

            switch (section.Type)
            {
               case SectionType.Header:
                  message.Header = (Header)section;
                  break;
               case SectionType.DeliveryAnnotations:
                  if (daConsumer != null)
                  {
                     daConsumer.Invoke((DeliveryAnnotations)section);
                  }
                  break;
               case SectionType.MessageAnnotations:
                  message.Annotations = (MessageAnnotations)section;
                  break;
               case SectionType.Properties:
                  message.Properties = (Properties)section;
                  break;
               case SectionType.ApplicationProperties:
                  message.ApplicationProperties = (ApplicationProperties)section;
                  break;
               case SectionType.Data:
               case SectionType.AmqpSequence:
               case SectionType.AmqpValue:
                  message.AddBodySection(section);
                  break;
               case SectionType.Footer:
                  message.Footer = (Footer)section;
                  break;
               default:
                  throw new ClientException("Unknown Message Section forced decode abort.");
            }
         }

         return message;
      }