Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239646

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. 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. 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. 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.

What can I do to get better diagnostic information at this point?

NServiceBus is at version 4.3. Servers are Windows Server 2008 R2.

Upvotes: 2

Views: 206

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239646

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.

Upvotes: 1

Related Questions