0

My NServiceBus is throwing a warning that it received an empty message and hence ignoring it. But the message is indeed not empty.

My bus configuration

Configure.With()
                 .Log4Net()
                 .DefaultBuilder()
                 .XmlSerializer()
                 .RavenSubscriptionStorage()
                 .MsmqTransport()
                     .IsTransactional(true)
                     .PurgeOnStartup(false)
                 .UnicastBus();

Here is the message. The xml is correct(I mean that the values and tags of the xml are correct compared to the object that I sent).

<Messages>
<Class1>
<Class2>
<QueueAddress>.\\private$\\myerrorqueue</QueueAddress>
<Category>Some string here</Category>
<ExtraInfo> </ExtraInfo>
<Priority> 1 </Priority>
<LookupValue> 1 </LookupValue>
</Class2>
</Class1>
</Messages>

The warning

2014-06-24 15:45:42,213 [Worker.14] WARN  NServiceBus.Unicast.UnicastBus [(null)
] - Received an empty message - ignoring.

I know that deserialization is not possible if there are only readonly properties. My interface doesn't have readonly properties.

public interface ISomeInterfaceImplementedByClass1
{
    Class2 class2{ get; set; }
}

As mentioned in NServiceBus - Server is throwing empty message warning to the console, I made sure to have same configuration for the bus at sender and receiver side but still the problem exists.

What might be the cause?

UPDATE: If I use JSONSerializer then appropriate handler is being invoked. So it doesn't work with XMLSerializer.

Community
  • 1
  • 1
user3344591
  • 567
  • 5
  • 21
  • I assume you're obfuscating your message due to security concerns, but as you have it it's almost unreadable. Could you change it to be a little more representative of the real message? For example, call a string property "StringA" and an int property "IntA" or something like that. – David Boike Jun 24 '14 at 21:08
  • Sorry about that. Edited the xml. Hope its somewhat more readable now. – user3344591 Jun 24 '14 at 21:36

1 Answers1

0

Reason : I was creating an instance of an interface and sending it. XMLSerializer was not serializing interfaces.

Instead of XMLSerializer, I used JSONSerializer and appropriate Handler was invoked.

user3344591
  • 567
  • 5
  • 21