barthoda
barthoda

Reputation: 153

MsmqSubscriptionStorage fails to record subscribers when using ServiceBroker.net as an NServiceBus transport

I'm using a SQL ServiceBroker transport for NServiceBus to hook into a third party CRM.

The pattern is described in the link above, my solution and the sample solution that have been provided both suffer from the same problem.

When using Configure.With().StructureMapBuilder().XmlSerializer().MsmqSubscriptionStorage().MsmqTransport().IsTransactional(true).PurgeOnStartup(false); the NServiceBus Host runs fine, however the subscription queues are not created, and subscribers are not stored in the queue if I create the subscription queue manually.

I'm not really sure how to progress, and thoughts greatly appreciated.

Debug logs from the publisher, summarised:

2011-11-25 10:27:04,712 [1] DEBUG NServiceBus.Serializers.XML [(null)] <(null)> - Initializing type: NServiceBus.Unicast.Transport.SubscriptionMessage, NServiceBus.Core, Version=2.6.0.1505, Culture=neutral, PublicKeyToken=9fc386479f8a226c
2011-11-25 10:27:04,837 [1] DEBUG NServiceBus.Unicast.UnicastBus [(null)] <(null)> - Message NServiceBus.Unicast.Transport.SubscriptionMessage has been allocated to endpoint .
2011-11-25 10:32:15,603 [Worker.5] INFO  NServiceBus.Unicast.UnicastBus [(null)] <(null)> - Subscribing Registration.IndividualHandler.InputQueue@COMPUTER to message type Messages.IIndividualUpdated, Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2011-11-25 10:47:55,493 [Worker.5] DEBUG NServiceBus.Unicast.UnicastBus [(null)] <(null)> - Sending message Messages.__Impl.IIndividualUpdated, NServiceBus.Grid.Messages.__Impl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null with ID c2267496-5f7e-4b3d-a1c4-69a7e68982a1\6367966 to destination Registration.IndividualHandler.InputQueue@COMPUTER.    

Upvotes: 1

Views: 332

Answers (1)

barthoda
barthoda

Reputation: 153

I have found a working solution, but this raises more questions.

I've changed the Init method from:

Configure.With()
    .StructureMapBuilder()
    .XmlSerializer()
    .MsmqSubscriptionStorage()
    .MsmqTransport()
            .IsTransactional(true)
            .PurgeOnStartup(false);

to:

Configure.With()
    .StructureMapBuilder()
    .XmlSerializer()
    .MsmqSubscriptionStorage()
    .MsmqTransport()
            .IsTransactional(true)
            .PurgeOnStartup(false)
    .UnicastBus()
    .LoadMessageHandlers()
    .CreateBus()
    .Start();

Now I get subscription persistence.

There must be some implicit call to .Start() somewhere that doesn't behave the same way as when I call it explicitly. Does anyone have an explanation for this different behaviour?

Upvotes: 1

Related Questions