Search code examples
azureazure-worker-rolesazureservicebusazure-servicebusrelay

Azure service bus - expose data from on-premises (call custom service)


I want to make some kind of agent (windows service maybe) that will run in background on a server on-premises, and expose an endpoint in Azure Service Bus.

I have a worker role in Azure that once a day will send a message to the agent on-premises and the agent will make a web request to an internal service and return some data.

The problem is the agent will run on different customers premises ... how can the worker role send a message to the correct customer agent service and make the call?

I will guess maybe topics and subscriptions will do it?


Solution

  • There are two options for this:

    • Messaging (async): you could indeed use topics and subscriptions and have your local agent listening on his specific subscription. Your worker role can then send the message to a topic with a specific property on that message, forcing it to end up on the specific subscription. If you want to have request/reply pattern over messaging, your client can send back the response to the service by adding a correlation property. (you could even use sessions for this: http://www.cloudcasts.net/devguide/Default.aspx?id=13051)
    • Relay (sync): here your local endpoint can expose an endpoint that is using a Service Bus relay binding. You could even have this exposed in a local IIS where you would not need your specific agent. So basically, you create a WCF service, apply the right binding and your service can call the specific endpoint of your client. Every client could have a 'subpath' in your service bus namespace. More information can be found here: http://msdn.microsoft.com/en-us/library/ee173579.aspx

    I hope this helps ?