/// <summary>
 /// Creates a new topic. Once created, this topic resource manifest is
 /// immutable. This operation is not idempotent. Repeating the create
 /// call, after a topic with same name has been created successfully,
 /// will result in a 409 Conflict error message.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780728.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='topic'>
 /// Required. The Service Bus topic.
 /// </param>
 /// <returns>
 /// A response to a request for a particular topic.
 /// </returns>
 public static ServiceBusTopicResponse Create(this ITopicOperations operations, string namespaceName, ServiceBusTopic topic)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ITopicOperations)s).CreateAsync(namespaceName, topic);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the ServiceBusManagementClient class.
 /// </summary>
 private ServiceBusManagementClient()
     : base()
 {
     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.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
Exemple #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 topic. Once created, this topic resource manifest is
 /// immutable. This operation is not idempotent. Repeating the create
 /// call, after a topic with same name has been created successfully,
 /// will result in a 409 Conflict error message.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780728.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <param name='topic'>
 /// The Service Bus topic.
 /// </param>
 /// <returns>
 /// A response to a request for a particular topic.
 /// </returns>
 public static ServiceBusTopicResponse Create(this ITopicOperations operations, string namespaceName, ServiceBusTopic topic)
 {
     try
     {
         return(operations.CreateAsync(namespaceName, topic).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// Gets the set of connection strings for a topic.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <param name='topicName'>
 /// The topic.
 /// </param>
 /// <returns>
 /// The set of connection details for a service bus entity.
 /// </returns>
 public static ServiceBusConnectionDetailsResponse GetConnectionDetails(this ITopicOperations operations, string namespaceName, string topicName)
 {
     try
     {
         return(operations.GetConnectionDetailsAsync(namespaceName, topicName).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// Creates a new topic. Once created, this topic resource manifest is
 /// immutable. This operation is not idempotent. Repeating the create
 /// call, after a topic with same name has been created successfully,
 /// will result in a 409 Conflict error message.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780728.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='topic'>
 /// Required. The Service Bus topic.
 /// </param>
 /// <returns>
 /// A response to a request for a particular topic.
 /// </returns>
 public static Task <ServiceBusTopicResponse> CreateAsync(this ITopicOperations operations, string namespaceName, ServiceBusTopic topic)
 {
     return(operations.CreateAsync(namespaceName, topic, CancellationToken.None));
 }
 /// <summary>
 /// Enumerates the topics in the service namespace. An empty feed is
 /// returned if no topic exists in the service namespace.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/hh780744.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <returns>
 /// A response to a request for a list of topics.
 /// </returns>
 public static Task <ServiceBusTopicsResponse> ListAsync(this ITopicOperations operations, string namespaceName)
 {
     return(operations.ListAsync(namespaceName, CancellationToken.None));
 }
 /// <summary>
 /// Gets the set of connection strings for a topic.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='topicName'>
 /// Required. The topic.
 /// </param>
 /// <returns>
 /// The set of connection details for a service bus entity.
 /// </returns>
 public static Task <ServiceBusConnectionDetailsResponse> GetConnectionDetailsAsync(this ITopicOperations operations, string namespaceName, string topicName)
 {
     return(operations.GetConnectionDetailsAsync(namespaceName, topicName, CancellationToken.None));
 }
 /// <summary>
 /// Deletes an existing topic. This operation will also remove all
 /// associated state including associated subscriptions.  (see
 /// http://msdn.microsoft.com/en-us/library/hh780721.aspx for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.ITopicOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='topicName'>
 /// Required. The topic.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <AzureOperationResponse> DeleteAsync(this ITopicOperations operations, string namespaceName, string topicName)
 {
     return(operations.DeleteAsync(namespaceName, topicName, CancellationToken.None));
 }