michaelandrepearce commented on a change in pull request #31: AMQNET-612: 
ObjectMessage shouldn't have jms-msg-type set
URL: https://github.com/apache/activemq-nms-amqp/pull/31#discussion_r323928092
 
 

 ##########
 File path: src/NMS.AMQP/Provider/Amqp/Message/AmqpCodec.cs
 ##########
 @@ -55,16 +55,26 @@ private static AmqpNmsMessageFacade 
CreateFromMsgAnnotation(MessageAnnotations m
                 {
                     case MessageSupport.JMS_TYPE_MSG:
                         return new AmqpNmsMessageFacade();
-                    case MessageSupport.JMS_TYPE_BYTE:
-                        return new AmqpNmsBytesMessageFacade();
                     case MessageSupport.JMS_TYPE_TXT:
                         return new AmqpNmsTextMessageFacade();
-                    case MessageSupport.JMS_TYPE_OBJ:
-                        return new AmqpNmsObjectMessageFacade();
                     case MessageSupport.JMS_TYPE_STRM:
                         return new AmqpNmsStreamMessageFacade();
                     case MessageSupport.JMS_TYPE_MAP:
                         return new AmqpNmsMapMessageFacade();
+                    case MessageSupport.JMS_TYPE_BYTE:
+                        return new AmqpNmsBytesMessageFacade();
+                    case MessageSupport.JMS_TYPE_OBJ:
+                    {
+                        Symbol contentType = 
GetContentType(message.Properties);
+                        if 
(IsContentType(SymbolUtil.SERIALIZED_DOTNET_OBJECT_CONTENT_TYPE, contentType) 
|| contentType == null)
+                        {
+                            return new AmqpNmsObjectMessageFacade();
+                        }
+                        
+                        // If the message has different content type defined 
we should treat it as bytes message
+                        // as there is a good chance that we cannot 
deserialize it using .NET binary deserializer
+                        return new AmqpNmsBytesMessageFacade();
 
 Review comment:
   Yup :) +1

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to