/// <summary> /// Creates a new queue. Once created, this queue's resource manifest /// is immutable. This operation is idempotent. Repeating the create /// call, after a queue with same name has been created successfully, /// will result in a 409 Conflict error message. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856295.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations. /// </param> /// <param name='namespaceName'> /// Required. The namespace name. /// </param> /// <param name='queue'> /// Required. The service bus queue. /// </param> /// <returns> /// A response to a request for a particular queue. /// </returns> public static ServiceBusQueueResponse Create(this IQueueOperations operations, string namespaceName, ServiceBusQueueCreateParameters queue) { return Task.Factory.StartNew((object s) => { return ((IQueueOperations)s).CreateAsync(namespaceName, queue); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Creates a new queue. Once created, this queue’s resource manifest /// is immutable. This operation is idempotent. Repeating the create /// call, after a queue with same name has been created successfully, /// will result in a 409 Conflict error message. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856295.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations. /// </param> /// <param name='namespaceName'> /// The namespace name. /// </param> /// <param name='queue'> /// The service bus queue. /// </param> /// <returns> /// A response to a request for a particular queue. /// </returns> public static ServiceBusQueueResponse Create(this IQueueOperations operations, string namespaceName, ServiceBusQueueCreateParameters queue) { try { return operations.CreateAsync(namespaceName, queue).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// Creates a new queue. Once created, this queue's resource manifest /// is immutable. This operation is idempotent. Repeating the create /// call, after a queue with same name has been created successfully, /// will result in a 409 Conflict error message. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856295.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations. /// </param> /// <param name='namespaceName'> /// Required. The namespace name. /// </param> /// <param name='queue'> /// Required. The service bus queue. /// </param> /// <returns> /// A response to a request for a particular queue. /// </returns> public static Task<ServiceBusQueueResponse> CreateAsync(this IQueueOperations operations, string namespaceName, ServiceBusQueueCreateParameters queue) { return operations.CreateAsync(namespaceName, queue, CancellationToken.None); }