本文整理汇总了C#中NamespaceManager.DeleteQueue方法的典型用法代码示例。如果您正苦于以下问题:C# NamespaceManager.DeleteQueue方法的具体用法?C# NamespaceManager.DeleteQueue怎么用?C# NamespaceManager.DeleteQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceManager
的用法示例。
在下文中一共展示了NamespaceManager.DeleteQueue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteQueue
private static void DeleteQueue(NamespaceManager namespaceManager)
{
Console.WriteLine("\nRemoving Queue '{0}'...", queueName);
// Delete if exists
if (namespaceManager.QueueExists(queueName))
{
namespaceManager.DeleteQueue(queueName);
}
}
示例2: 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;
}
Console.WriteLine("\nCreating Queue '{0}'...", QueueName);
//Eliminar se a queue já existir
if (namespaceClient.QueueExists(QueueName))
namespaceClient.DeleteQueue(QueueName);
namespaceClient.CreateQueue(QueueName);
QueueClient myQueueClient = CreateQueueClient(serviceUri, credentials, out factory);
List<BrokeredMessage> messageList = new List<BrokeredMessage>();
messageList.Add(CreateIssueMessage("1", "First message "));
messageList.Add(CreateIssueMessage("2", "Second message "));
messageList.Add(CreateIssueMessage("3", "Third message "));
SendListOfMessages(messageList, myQueueClient);
}
catch (Exception e)
{
Console.WriteLine("Unexpected exception {0}", e.ToString());
throw;
}
finally
{
if (factory != null)
factory.Close();
}
}
示例3: RemoveAllExistingNamespaceElements
/// <summary>
/// Danger! Danger, Will Robinson!
/// </summary>
private static void RemoveAllExistingNamespaceElements(NamespaceManager namespaceManager)
{
var tasks = new List<Task>();
var queuePaths = namespaceManager.GetQueues().Select(q => q.Path).ToArray();
queuePaths
.Do(queuePath => tasks.Add(Task.Run(() => namespaceManager.DeleteQueue(queuePath))))
.Done();
var topicPaths = namespaceManager.GetTopics().Select(t => t.Path).ToArray();
topicPaths
.Do(topicPath => tasks.Add(Task.Run(() => namespaceManager.DeleteTopic(topicPath))))
.Done();
tasks.WaitAll();
}
示例4: Main
static void Main(string[] args)
{
try
{
if (args.Count() != 0)
{
if (args[0].ToLower().CompareTo("createqueue") == 0)
{
// No processing to occur other than creating the queue.
namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
namespaceManager.CreateQueue(queueName);
Console.WriteLine("Queue named {0} was created.", queueName);
Environment.Exit(0);
}
if (args[0].ToLower().CompareTo("deletequeue") == 0)
{
// No processing to occur other than deleting the queue.
namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
namespaceManager.DeleteQueue(queueName);
Console.WriteLine("Queue named {0} was deleted.", queueName);
Environment.Exit(0);
}
}
//queueClient = QueueClient.CreateFromConnectionString(connectionString, queueName);
Run(305);
Console.WriteLine("Final solution found!");
//queueClient.Send(new BrokeredMessage("Complete"));
//queueClient.Close();
//Environment.Exit(0);
}
catch (ServerBusyException serverBusyException)
{
Console.WriteLine("ServerBusyException encountered");
Console.WriteLine(serverBusyException.Message);
Console.WriteLine(serverBusyException.StackTrace);
if(streamWriter!=null)
{
streamWriter.WriteLine(serverBusyException.Message);
streamWriter.WriteLine(serverBusyException.StackTrace);
streamWriter.Close();
}
int fileCount = GetFileCountFromDir(@"output/")+10;
Run(fileCount);
//Environment.Exit(-1);
}
catch (ServerErrorException serverErrorException)
{
Console.WriteLine("ServerErrorException encountered");
Console.WriteLine(serverErrorException.Message);
Console.WriteLine(serverErrorException.StackTrace);
if (streamWriter != null)
{
streamWriter.WriteLine(serverErrorException.Message);
streamWriter.WriteLine(serverErrorException.StackTrace);
streamWriter.Close();
}
int fileCount = GetFileCountFromDir(@"output/")+10;
Run(fileCount);
//Environment.Exit(-1);
}
catch (Exception exception)
{
Console.WriteLine("Exception encountered");
Console.WriteLine(exception.Message);
Console.WriteLine(exception.StackTrace);
if (streamWriter != null)
{
streamWriter.WriteLine(exception.Message);
streamWriter.WriteLine(exception.StackTrace);
streamWriter.Close();
}
int fileCount = GetFileCountFromDir(@"output/")+10;
Run(fileCount);
//Environment.Exit(-1);
}
}
示例5: DeleteQueue
//Helpers
static void DeleteQueue(Uri baseAddress,string queueName,TokenProvider credentials)
{
if(baseAddress.AbsoluteUri.EndsWith("/") == false)
{
baseAddress = new Uri(baseAddress.AbsoluteUri + "/");
}
Debug.Assert(baseAddress.Scheme == "sb");
if(QueueExists(baseAddress,queueName,credentials))
{
NamespaceManager namespaceClient = new NamespaceManager(baseAddress,credentials);
namespaceClient.DeleteQueue(queueName);
}
}
示例6: RemoveAllExistingNamespaceElements
/// <summary>
/// Danger! Danger, Will Robinson!
/// </summary>
private static void RemoveAllExistingNamespaceElements(NamespaceManager namespaceManager, ILogger logger)
{
logger.Debug("Removing all existing namespace elements. IMPORTANT: This should only be done in your regression test suites.");
var tasks = new List<Task>();
var queuePaths = namespaceManager.GetQueues().Select(q => q.Path).ToArray();
queuePaths
.Do(queuePath => tasks.Add(Task.Run(() => namespaceManager.DeleteQueue(queuePath))))
.Done();
var topicPaths = namespaceManager.GetTopics().Select(t => t.Path).ToArray();
topicPaths
.Do(topicPath => tasks.Add(Task.Run(() => namespaceManager.DeleteTopic(topicPath))))
.Done();
tasks.WaitAll();
}