Hello, we were getting the startup message “Because no message serializer was selected, the default XmlSerializer will be used”… so we added this:
endpointConfiguration.UseSerialization();
We need to continue with NSB message serialization using XML, but we also need to handle messages in JSON format, as we are integrating native SQS messages. So we added this:
endpointConfiguration.AddDeserializer();
When I get a native message from SQS, it is failing like so:
NServiceBus.MessageDeserializationException: An error occurred while attempting to extract logical messages from incoming physical message ee9268ff-ffd0-43c4-a007-9312503252e8
—> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
I assumed it would try another registered deserializer if it failed XML parsing. What is the right way to set up default serialization as XML with support for JSON when such messages come in?
and I had done an exercise where I put a message on the queue in XML (before making this change), then made the change and processed the message, showing that both XML and JSON were working. Here, though, the JSON message is coming in via native SQS message. Maybe that has somethign to do with the difference?
I’m glad you have been able to resolve your issue. For future reference, you can find information on the different message headers that NServiceBus uses on our docs page. Our page on Native SQS integrations also contains some information that you might find helpful for projects which interact with non-NServiceBus message creators/consumers. There is also an SQS Native Integration Sample available.