public AzureServiceBusSubscriptionSubscriberEndpointManager(
            WindowsServiceBusSubscriptionSubscriberEndpoint endpoint, IWindowsServiceBusConfiguration sbConfiguration)
            : base(sbConfiguration)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }

            endpoint.Validate();

            this.endpoint = endpoint;
        }
Exemple #2
0
        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);
            }
        }