public AzureServiceBusTopicPublisherClient(AzureServiceBusTopicPublisherEndpoint endpoint, IAzureServiceBusConfiguration sbConfiguration) : base(sbConfiguration) { if (endpoint == null) { throw new ArgumentNullException("endpoint"); } endpoint.Validate(); try { if (NsManager.TopicExists(endpoint.TopicName) == false) { NsManager.CreateTopic(endpoint.TopicName); } topicClient = TopicClient.CreateFromConnectionString(sbConfiguration.ConnectionString, endpoint.TopicName); topicClient.RetryPolicy = RetryExponential.Default; } catch (Exception ex) { throw new MessagingException( String.Format( "An error occurred while attempting to access the specified Azure service bus topic [{0}]. See inner exception for more details.", endpoint.TopicName), ex); } }
public WindowsServiceBusSubscriptionSubscriberClient(WindowsServiceBusSubscriptionSubscriberEndpoint endpoint, IWindowsServiceBusConfiguration sbConfiguration) : base(sbConfiguration) { if (endpoint == null) { throw new ArgumentNullException("endpoint"); } endpoint.Validate(); try { if (NsManager.TopicExists(endpoint.TopicName) == false) { NsManager.CreateTopic(endpoint.TopicName); } if (NsManager.SubscriptionExists(endpoint.TopicName, endpoint.SubscriptionName) == false) { NsManager.CreateSubscription(endpoint.TopicName, endpoint.SubscriptionName); } subscriptionClient = SubscriptionClient.CreateFromConnectionString(sbConfiguration.ConnectionString, endpoint.TopicName, endpoint.SubscriptionName); } catch (Exception ex) { throw new MessagingException( String.Format( "An error occurred while attempting to access the specified Windows service bus subscription [{0}]. See inner exception for more details.", endpoint.TopicName), ex); } }
public bool DoesExist() { return(NsManager.TopicExists(endpoint.TopicName)); }