如何在版本5中检索NServiceBus邮件头?

时间:2015-04-17 15:04:30

标签: nservicebus

我有以下行来获取IHandleMessages<>中的邮件头类

 IDictionary<string, string> headers = _bus.CurrentMessageContext.Headers;

我收到错误消息

  

总线未实现IManageMes​​sageHeaders

我原以为这是默认配置的。有谁知道如何实现IManageMes​​sageHeaders?我是否需要更改端点的配置方式?

 public class EndpointConfig : IConfigureThisEndpoint
{
    public void Customize(BusConfiguration configuration)
    {
        configuration.UsePersistence<InMemoryPersistence>();
        ConfigureLog4Net();
    }

    private void ConfigureLog4Net()
    {
        log4net.Config.XmlConfigurator.Configure();

        var layout = new PatternLayout
        {
            ConversionPattern = "%d [%t] %-5p %c [%x] - %m%n"
        };
        layout.ActivateOptions();
        var consoleAppender = new ColoredConsoleAppender
        {
            Threshold = Level.Debug,
            Layout = layout
        };
        consoleAppender.ActivateOptions();
        BasicConfigurator.Configure(consoleAppender);


        LogManager.Use<Log4NetFactory>();
    }
}

我使用NServiceBus Host 6.0.0,NServiceBus 5.1.2。

0 个答案:

没有答案