Hi Team
I have been using Azure topic and subscription in my application, i do see on regular basis timeout error from Azure. This is snippet of code which i uses. THis typically happens when there is inactivity at the service bus namespace i.e. no request or communication happens with service bus for a long period of time
if (!namespaceManager.TopicExists(topicName))
{
TopicDescription topicMetaData = new TopicDescription(topicName);
topicMetaData.MaxSizeInMegabytes = 5120;
topicMetaData.DefaultMessageTimeToLive = TimeSpan.FromDays(topicTTLInDays);
namespaceManager.CreateTopic(topicMetaData);
}
//Create the Subscription with Filter
if (!namespaceManager.SubscriptionExists(topicName, subscriptionName))
{
RuleDescription ruleMetaData = new RuleDescription();
ruleMetaData.Name = "SubscriptionRule";
ruleMetaData.Filter = new SqlFilter(filterExpression);
namespaceManager.CreateSubscription(topicName, subscriptionName, ruleMetaData);
}
else
{
IEnumerable<RuleDescription> rules = namespaceManager.GetRules(topicName, subscriptionName);
foreach (RuleDescription rule in rules)
{
if (rule.Name == "SubscriptionRule")
{
SubscriptionClient client = SubscriptionClient.CreateFromConnectionString(sbConnectionString, topicName, subscriptionName);
client.RemoveRule("SubscriptionRule");
RuleDescription ruleMetaData = new RuleDescription();
ruleMetaData.Name = "SubscriptionRule";
ruleMetaData.Filter = new SqlFilter(filterExpression);
client.AddRule(ruleMetaData);
}
}
Error information is:
Exception Information Details:
======================================
Exception Type: System.TimeoutException
Message: The request has timed out after 60000 milliseconds. The successful completion of the request cannot be determined. Additional queries should be made to determine whether or not the operation has succeeded.
Target Site: TAsyncResult End[TAsyncResult](System.IAsyncResult)
Help Link:
Source: Microsoft.ServiceBus
Stack Trace Information Details:
======================================
Server stack trace:
Exception rethrown at [0]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.NamespaceManager.OnEndSubscriptionExists(IAsyncResult result)
at Microsoft.ServiceBus.NamespaceManager.SubscriptionExists(String topicPath, String name)
Exception Information Details:
======================================
Exception Type: System.Net.WebException
Status: RequestCanceled
Response:
Message: The request was aborted: The request was canceled.
Target Site: System.Net.WebResponse EndGetResponse(System.IAsyncResult)
Help Link:
Source: System
Thanks
Deepak Sanghi
Deepak Sanghi Happy Biztalking.........