【问题标题】:NServiceBus : Received an empty messageNServiceBus : 收到一条空消息
【发布时间】:2014-06-24 19:52:56
【问题描述】:

我的 NServiceBus 发出警告说它收到了一条空消息,因此忽略了它。 但消息确实不是空的。

我的总线配置

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

这是消息。 xml 是正确的(我的意思是 xml 的值和标签与我发送的对象相比是正确的)。

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

警告

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

我知道如果只有只读属性,则无法进行反序列化。我的界面没有只读属性。

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

正如NServiceBus - Server is throwing empty message warning to the console 中提到的,我确保发送方和接收方的总线配置相同,但问题仍然存在。

可能是什么原因?

更新: 如果我使用 JSONSerializer 则将调用适当的处理程序。所以它不适用于 XMLSerializer。

【问题讨论】:

  • 我假设您出于安全考虑而混淆了您的消息,但正如您所拥有的那样,它几乎无法阅读。你能把它改成更能代表真实信息吗?例如,调用一个字符串属性“StringA”和一个 int 属性“IntA”或类似的东西。
  • 很抱歉。编辑了xml。希望它现在更具可读性。

标签: c# nservicebus


【解决方案1】:

原因:我正在创建一个接口实例并发送它。 XMLSerializer 没有序列化接口。

我使用 JSONSerializer 而不是 XMLSerializer,并调用了适当的 Handler。

【讨论】:

    猜你喜欢
    • 2011-10-11
    • 2022-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-15
    • 2013-08-15
    • 2016-05-11
    相关资源
    最近更新 更多