3
votes

It appears that all the sample projects that ship with nServicebus are setup where the sender and host are web roles and worker roles (and hosted via role entry point).

I have a need to do something like this:

Web Role sends message --> On Premise Host handles message

Is it possible to configure an on premise Host to use Azure Queue storage only (and not MSMQ)?

I can't seem to find a single example of this documented anywhere.

2

2 Answers

3
votes

Yes this is possible, you simply have to specify the transport when initializing the Bus:

   var config = Configure.With()
                 .SpringBuilder()
                 .AzureConfigurationSource() <--- Don't use this when working on premise.
                 .XmlSerializer()
                 .UnicastBus()
                 .LoadMessageHandlers()
                 .AzureQueuesTransport()  <--- Configure Azure Storage Queues
                 .IsTransactional(true)
                 .PurgeOnStartup(false)
                 .InMemorySubscriptionStorage();

For the documentation part, I suggest you take a look on github: https://github.com/NServiceBus/NServiceBus/tree/master/Samples/Azure

Note that most of these samples are meant to run in Windows Azure, hence the use of the AzureConfigurationSource. This won't work when you're running on premise since it uses settings from the RoleEnvironment. Don't use AzureConfigurationSource when working on premise.

-1
votes

I haven't used nServiceBus but it sounds like Azure Service Bus would be your best option here for Hybrid communication between on-premises and Azure.

You could use ServiceBus Queues or be more intelligent about your model and do pub/sub via Topics and Subscriptions.

In this example you could have your Web Role write to a queue/topic and then have an on-premises consumer read from the queue/topic via a REST(.NET API). (see example in the link below)

Check out a link to the MSDN on them: http://msdn.microsoft.com/en-us/library/windowsazure/hh367516.aspx

Of course maybe asking Udi Dahan what is the best way forward might also be a good idea :)