public void TestInitialize()
        {
            QueueList = new List<Queue>(new[] { new Queue("localhost", "queue"), new Queue("localhost", "test") });
            Messages = new List<MessageInfo>(new[] { new MessageInfo(), new MessageInfo() });

            QueueOperations = Substitute.For<IQueueOperations>();
            QueueOperations.GetQueues(Arg.Any<string>()).Returns(QueueList);
            QueueOperations.GetMessages(Arg.Any<Queue>()).Returns(Messages);

            QueueManager = new QueueManager(QueueOperations);
        }
示例#2
0
        public void TestInitialize()
        {
            QueueList = new List <Queue>(new[] { new Queue("localhost", "queue"), new Queue("localhost", "test") });
            Messages  = new List <MessageInfo>(new[] { new MessageInfo(), new MessageInfo() });

            QueueOperations = Substitute.For <IQueueOperations>();
            QueueOperations.GetQueues(Arg.Any <string>()).Returns(QueueList);
            QueueOperations.GetMessages(Arg.Any <Queue>()).Returns(Messages);

            QueueManager = new QueueManager(QueueOperations);
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the ServiceBusManagementClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public ServiceBusManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._namespaces       = new NamespaceOperations(this);
     this._notificationHubs = new NotificationHubOperations(this);
     this._queues           = new QueueOperations(this);
     this._relays           = new RelayOperations(this);
     this._topics           = new TopicOperations(this);
     this._apiVersion       = "2013-08-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
 /// <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>
 /// Enumerates the queues in the service namespace. The result is
 /// returned in pages, each containing up to 100 queues. If the
 /// namespace contains more than 100 queues, a feed is returned that
 /// contains the first page and a next link with the URI to view the
 /// next page of data.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780759.asp
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <returns>
 /// A response to a request for a list of queues.
 /// </returns>
 public static ServiceBusQueuesResponse List(this IQueueOperations operations, string namespaceName)
 {
     try
     {
         return(operations.ListAsync(namespaceName).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// Gets the set of connection strings for a queue.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <param name='queueName'>
 /// The queue name.
 /// </param>
 /// <returns>
 /// The set of connection details for a service bus entity.
 /// </returns>
 public static ServiceBusConnectionDetailsResponse GetConnectionDetails(this IQueueOperations operations, string namespaceName, string queueName)
 {
     try
     {
         return(operations.GetConnectionDetailsAsync(namespaceName, queueName).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
示例#7
0
 public QueueManager(IQueueOperations queueOperations)
 {
     _queueOperations = queueOperations;
 }
 /// <summary>
 /// Deletes the queue with the specified queue name, under the specified
 /// account if it exists.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='queueName'>
 /// A queue name must be unique within a storage account and must be between 3
 /// and 63 characters.The name must comprise of lowercase alphanumeric and
 /// dash(-) characters only, it should begin and end with an alphanumeric
 /// character and it cannot have two consecutive dash(-) characters.
 /// </param>
 public static void Delete(this IQueueOperations operations, string resourceGroupName, string accountName, string queueName)
 {
     operations.DeleteAsync(resourceGroupName, accountName, queueName).GetAwaiter().GetResult();
 }
示例#9
0
 /// <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));
 }
示例#10
0
 /// <summary>
 /// Enumerates the queues in the service namespace. The result is
 /// returned in pages, each containing up to 100 queues. If the
 /// namespace contains more than 100 queues, a feed is returned that
 /// contains the first page and a next link with the URI to view the
 /// next page of data.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780759.asp
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <returns>
 /// A response to a request for a list of queues.
 /// </returns>
 public static Task <ServiceBusQueuesResponse> ListAsync(this IQueueOperations operations, string namespaceName)
 {
     return(operations.ListAsync(namespaceName, CancellationToken.None));
 }
示例#11
0
 /// <summary>
 /// Gets the set of connection strings for a queue.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='queueName'>
 /// Required. The queue name.
 /// </param>
 /// <returns>
 /// The set of connection details for a service bus entity.
 /// </returns>
 public static Task <ServiceBusConnectionDetailsResponse> GetConnectionDetailsAsync(this IQueueOperations operations, string namespaceName, string queueName)
 {
     return(operations.GetConnectionDetailsAsync(namespaceName, queueName, CancellationToken.None));
 }
示例#12
0
 /// <summary>
 /// Deletes an existing queue. This operation will also remove all
 /// associated state including messages in the queue.  (see
 /// http://msdn.microsoft.com/en-us/library/hh780747.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='queueName'>
 /// Required. The queue name.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <OperationResponse> DeleteAsync(this IQueueOperations operations, string namespaceName, string queueName)
 {
     return(operations.DeleteAsync(namespaceName, queueName, CancellationToken.None));
 }
 /// <summary>
 /// Deletes the queue with the specified queue name, under the specified
 /// account if it exists.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='queueName'>
 /// A queue name must be unique within a storage account and must be between 3
 /// and 63 characters.The name must comprise of lowercase alphanumeric and
 /// dash(-) characters only, it should begin and end with an alphanumeric
 /// character and it cannot have two consecutive dash(-) characters.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this IQueueOperations operations, string resourceGroupName, string accountName, string queueName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, queueName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
示例#14
0
 public QueueManager(IQueueOperations queueOperations)
 {
     _queueOperations = queueOperations;
 }
 /// <summary>
 /// Gets the queue with the specified queue name, under the specified account
 /// if it exists.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='queueName'>
 /// A queue name must be unique within a storage account and must be between 3
 /// and 63 characters.The name must comprise of lowercase alphanumeric and
 /// dash(-) characters only, it should begin and end with an alphanumeric
 /// character and it cannot have two consecutive dash(-) characters.
 /// </param>
 public static StorageQueue Get(this IQueueOperations operations, string resourceGroupName, string accountName, string queueName)
 {
     return(operations.GetAsync(resourceGroupName, accountName, queueName).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates a new queue with the specified queue name, under the specified
 /// account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='queueName'>
 /// A queue name must be unique within a storage account and must be between 3
 /// and 63 characters.The name must comprise of lowercase alphanumeric and
 /// dash(-) characters only, it should begin and end with an alphanumeric
 /// character and it cannot have two consecutive dash(-) characters.
 /// </param>
 /// <param name='metadata'>
 /// A name-value pair that represents queue metadata.
 /// </param>
 public static StorageQueue Create(this IQueueOperations operations, string resourceGroupName, string accountName, string queueName, IDictionary <string, string> metadata = default(IDictionary <string, string>))
 {
     return(operations.CreateAsync(resourceGroupName, accountName, queueName, metadata).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Gets a list of all the queues under the specified storage account
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 public static IPage <ListQueue> ListNext(this IQueueOperations operations, string nextPageLink)
 {
     return(operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Gets a list of all the queues under the specified storage account
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='maxpagesize'>
 /// Optional, a maximum number of queues that should be included in a list
 /// queue response
 /// </param>
 /// <param name='filter'>
 /// Optional, When specified, only the queues with a name starting with the
 /// given filter will be listed.
 /// </param>
 public static IPage <ListQueue> List(this IQueueOperations operations, string resourceGroupName, string accountName, string maxpagesize = default(string), string filter = default(string))
 {
     return(operations.ListAsync(resourceGroupName, accountName, maxpagesize, filter).GetAwaiter().GetResult());
 }