How to deploy a Azure application into production without Azure
I am developing an Azure application using queue开发者_高级运维s, blob storage and SQL Azure. We anticipate that some clients will not be willing to have their data hosted in the cloud (for reasons of paranoia or legal limitations on the jurisdiction in which data can be stored) and will want to run the system on a server located within their own data centres, on a single server. Using SQL Server and building an alternative to blob storage should be easy, but Azure queues are a more complicated. I guess using the development fabric is undesirable because the MS documentation says it must run as administrator.
How should I go about this?
I would add a layer of abstraction over the AzureQueues.
Something like:
public interface IQueueService
{
// will create if not exists
IQueue GetQueue(string name);
IQueue GetQueueIfExists(string name);
}
public interface IQueue
{
string Name { get; set; }
void AddMessage(SimpleMessage message);
void DeleteMessage(SimpleMessage message);
SimpleMessage PeekMessage();
void Clear();
}
etc...
That should give you an idea. You can then provide two implementations, one that utilizes AzureQueues and another one that uses MS Queues (http://en.wikipedia.org/wiki/Microsoft_Message_Queuing)
You choose the implementation depending on whether you are running on Azure or not.
I have done something very similar in the past.
You don't need to run on the developer fabric to access azure resources. Blobs are very easy to access via the web, I'm fairly certain you can do it with tables and Queues as well as the "http://'accountname'.queue.core.windows.net/" URLs are publicly available.
For a neat solution you should look at Azure AppFabric service bus, it basically allows you to connect, or "project" an on premise app web service endpoints into the cloud, it's basically a relay service. (It sound like magic, but it's actually pretty simple). You can use the same Service Bus to give Azure Worker Role services public Url endpoints.
http://msdn.microsoft.com/en-us/library/ee732537.aspx
http://www.microsoft.com/windowsazure/appfabric/overview/default.aspx
精彩评论