Пример #1
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);
            }
        }
Пример #2
0
 public void Create()
 {
     NsManager.CreateSubscription(endpoint.TopicName, endpoint.SubscriptionName);
 }
Пример #3
0
 public void Create <T>()
 {
     NsManager.CreateSubscription(endpoint.TopicName, endpoint.SubscriptionName,
                                  new SqlFilter(String.Format("MantleType = '{0}'",
                                                              typeof(T).GetMessagingTypeString())));
 }