I’ve been through the docs and numerous Github issues but I’m still not sure if what I want to do is possible with NServiceBus + SQS transport.
Problem: I want to have an endpoint that will consume a native message from SQS. The message will be in JSON but not base64-encoded. I then want my endpoint to handle the message, do stuff, then publish a proper NServiceBus message for my other endpoints to consume.
I’m using the following code for my endpoint’s serialization:
var serializer = endpointConfiguration.UseSerialization<NewtonsoftJsonSerializer>();
serializer.Settings(new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
I tested this by adding a message in SQS and adding a $type
property that contains the fully qualified class name of the message.
I get the error:
Newtonsoft.Json.JsonSerializationException: Type specified in JSON '<FullClassName>' was not resolved. Path '$type', line 2, position 55.
My questions are:
- Why can’t NServiceBus successfully deserialize the message given there’s a
$type
property? - Is it possible for my endpoint to publish a proper NServiceBus message if I configure the serializer to use
TypeNameHandling.Auto