1

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.    
3
  • Do you see any subscription messages being sent between your endpoints? Nov 24, 2011 at 7:47
  • Yes. It appears as though even though the In Memory subscription storage is being used. I'm running AsAPublisher with IWantCustomInitialization with the above line of code for the configurer. Both the subscriber and publisher actually work, messages fly past, but there's no subscription persistence.
    – barthoda
    Nov 24, 2011 at 22:49
  • Also to note I have MsmqSubscriptionStorage running in other publishers, but not ones that use the above servicebroker transport example. In my successful subscrption persitence implementations I've only ever used the DefaultBuilder.
    – barthoda
    Nov 24, 2011 at 23:00

1 Answer 1

1

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?

3
  • Yes, if the bus isn't started it wont process the subscriptions Nov 25, 2011 at 9:26
  • How is it possible that you are configuring MsmqTransport and claim that you are using SQL service broker?
    – nightwatch
    Nov 29, 2011 at 11:02
  • @nightwatch have a look at the sample linked in the original question that shows how you can use both transports simultaneously.
    – barthoda
    Nov 30, 2011 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.