예제 #1
0
        public AzureServiceBusSubscriptionSubscriberEndpointManager(
            AzureServiceBusSubscriptionSubscriberEndpoint endpoint, IAzureServiceBusConfiguration sbConfiguration)
            : base(sbConfiguration)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }

            endpoint.Validate();

            this.endpoint = endpoint;
        }
예제 #2
0
        public AzureServiceBusSubscriptionSubscriberClient(AzureServiceBusSubscriptionSubscriberEndpoint 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);
                }

                if (NsManager.SubscriptionExists(endpoint.TopicName, endpoint.SubscriptionName) == false)
                {
                    NsManager.CreateSubscription(endpoint.TopicName, endpoint.SubscriptionName);
                }

                subscriptionClient = SubscriptionClient.CreateFromConnectionString(sbConfiguration.ConnectionString,
                                                                                   endpoint.TopicName,
                                                                                   endpoint.SubscriptionName);

                subscriptionClient.RetryPolicy = RetryExponential.Default;
            }
            catch (Exception ex)
            {
                throw new MessagingException(
                          String.Format(
                              "An error occurred while attempting to access the specified Azure service bus subscription [{0}]. See inner exception for more details.",
                              endpoint.TopicName),
                          ex);
            }
        }