本文整理汇总了C#中NamespaceManager.GetQueue方法的典型用法代码示例。如果您正苦于以下问题:C# NamespaceManager.GetQueue方法的具体用法?C# NamespaceManager.GetQueue怎么用?C# NamespaceManager.GetQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceManager
的用法示例。
在下文中一共展示了NamespaceManager.GetQueue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SBMessageCounter
public SBMessageCounter(string ns, string queue, string keyName, string key)
{
var sb = ServiceBusEnvironment.CreateServiceUri("sb", ns, String.Empty);
TokenProvider tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, key);
NamespaceManager sbus = new NamespaceManager(sb, tokenProvider);
var q = sbus.GetQueue(queue);
MessageCount = q.MessageCount;
}
示例2: PurgeQueue
public static void PurgeQueue(Uri baseAddress,string queueName,TokenProvider credentials)
{
Debug.Assert(QueueExists(baseAddress,queueName,credentials));
NamespaceManager namespaceClient = new NamespaceManager(baseAddress,credentials);
QueueDescription description = namespaceClient.GetQueue(queueName);
DeleteQueue(baseAddress,queueName,credentials);
CreateQueue(baseAddress,queueName,description,credentials);
}
示例3: Main
static void Main(string[] args)
{
GetUserCredentials();
TokenProvider credentials = null;
Uri serviceUri = null;
CreateTokenProviderAndServiceUri(out credentials, out serviceUri);
MessagingFactory factory = null;
try
{
NamespaceManager namespaceClient = new NamespaceManager(serviceUri, credentials);
if (namespaceClient == null)
{
Console.WriteLine("\nUnexpected Error: NamespaceManager is NULL");
return;
}
QueueDescription queueDescription = namespaceClient.GetQueue(Receiver.QueueName);
if (queueDescription == null)
{
Console.WriteLine("\nUnexpected Error: QueueDescription is NULL");
return;
}
QueueClient myQueueClient = CreateQueueClient(serviceUri, credentials, out factory);
Console.WriteLine("\nReceiving messages from Queue '{0}'...", Receiver.QueueName);
// Numero actual de mensagens na queue
long messageCount = queueDescription.MessageCount;
ReceiveNMessagesFromQueue(myQueueClient, messageCount);
Console.WriteLine("\nEnd of scenario, press ENTER to exit.");
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("Unexpected exception {0}", e.ToString());
throw;
}
finally
{
if (factory != null) factory.Close();
}
}
示例4: QueueExists
static bool QueueExists(Uri baseAddress,string queueName,TokenProvider credentials,bool requiresSession = false)
{
try
{
NamespaceManager namespaceClient = new NamespaceManager(baseAddress,credentials);
QueueDescription queue = namespaceClient.GetQueue(queueName);
return true;
}
catch(MessagingEntityNotFoundException)
{}
return false;
}