简体   繁体   English

订户不阅读事件消息

[英]Subscriber not reading event messages

I have a small service that's built on NServiceBus and is meant to listen for certain events happening elsewhere. 我有一个基于NServiceBus的小型服务,旨在监听其他地方发生的某些事件。 The Endpoint configuration class looks like: 端点配置类如下所示:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
    public void Init()
    {
        var container = new WindsorContainer();

        try
        {
            SetLoggingLibrary.Log4Net(() => XmlConfigurator.Configure());

            Configure.Serialization.Xml();
            Configure.Features.Enable<Sagas>();
            Configure.With()
                .CastleWindsorBuilder(container)
                .DefiningCommandsAs(t => 
                   t.GetCustomAttributes(typeof(CustomCommandAttribute), false)
                    .GetLength(0) > 0)
                .DefiningEventsAs(t => 
                   t.GetCustomAttributes(typeof(CustomEventAttribute), false)
                    .GetLength(0) > 0)
                .Log4Net()
                .UseNHibernateTimeoutPersister()
                .UseNHibernateSagaPersister()
                ;
        }
        catch (Exception ex)
        {
            throw new Exception("Configuration did not work. " + Environment.NewLine +
                                                    string.Format("Config file: {0}", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile) +
                                                    Environment.NewLine +
                                                    ex.Message, ex);
        }
        //More stuff adding other non-NSB facilities into the container.
        //Pretty certain it's not relevant here, but if people think it is it can be added
    }
}

The service contains one handler, that handles one event - the event class itself is decorated with the CustomEventAttribute attribute, other subscriptions have been built subscribing to the same publisher and for the same event. 该服务包含一个处理程序,用于处理一个事件-事件类本身用CustomEventAttribute属性修饰,其他订阅的订阅者都针对同一发布者和同一事件进行了构建。 All seems fine. 一切似乎都很好。

The service starts up, and I can see an entry in the publisher's subscription database: 服务启动,我可以在发布者的订阅数据库中看到一个条目:

SubscriberEndpoint                  MessageType                            Version       TypeName
----------------------------------- -------------------------------------- ------------- ---------------------------
MySubscriber@MySubscribersMachine   Namespaces.PrincipalAdded,1.1.3.37147  1.1.3.37147   Namespaces.PrincipalAdded

After this, the publisher has published 4 messages of this type, and I can see 4 messages sitting in the MySubscriber queue on MySubscribersMachine . 在此之后,发行商已发行这种类型的4个消息,我可以看到坐在4条消息在MySubscriber队列上MySubscribersMachine And then - nothing happens. 然后-没有任何反应。

Our log4net configuration is logging NServiceBus as the DEBUG level - so I'm seeing, for instance, that this same service is polling for NSB timeouts every minute - and yet I'm not seeing any information about it even attempting to consume these messages and invoke the handler. 我们的log4net配置将NServiceBus记录为DEBUG级别-因此,例如,我看到该服务正在每分钟轮询一次NSB超时-但即使尝试使用这些消息,我也看不到任何有关它的信息。调用处理程序。

What can I do to get better diagnostic information at this point? 此时我该怎么做才能获得更好的诊断信息?

NServiceBus is at version 4.3. NServiceBus的版本为4.3。 Servers are Windows Server 2008 R2. 服务器是Windows Server 2008 R2。

Apparently, if the user account the service is running under doesn't have permission to access its own queues, that's not worth emitting anything into the logs. 显然,如果运行该服务的用户帐户没有访问自己队列的权限,则不值得将任何内容发送到日志中。

We have given the account permission to read from the queues and now it's operating correctly. 我们已授予该帐户读取队列的权限,现在它可以正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM