Exemplo n.º 1
0
        /// <summary>
        /// This method creates the queue if it does not exist.
        /// </summary>
        public static void EventHubFabricInitialize(this AzureConnection conn, string name)
        {
            if (conn.NamespaceManager.EventHubExists(name))
            {
                return;
            }

            try
            {
                conn.NamespaceManager.CreateEventHubIfNotExists(EventHubDescriptionGet(name));
            }
            catch (MessagingEntityAlreadyExistsException)
            {
                // Another service created it before we did - just use that one
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method creates the topic if it does not exist.
        /// </summary>
        public static TopicDescription TopicFabricInitialize(this AzureConnection conn, string name
                                                             , TimeSpan?defaultMessageTTL = null
                                                             )
        {
            if (!conn.NamespaceManager.TopicExists(name))
            {
                try
                {
                    return(conn.NamespaceManager.CreateTopic(TopicDescriptionGet(name, defaultMessageTTL)));
                }
                catch (MessagingEntityAlreadyExistsException)
                {
                    // Another service created it before we did - just retrieve the one it created
                }
            }

            return(conn.NamespaceManager.GetTopic(name));
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method creates the queue if it doesn't already exist.
        /// </summary>
        public static QueueDescription QueueFabricInitialize(this AzureConnection conn, string name
                                                             , TimeSpan?defaultMessageTTL = null
                                                             , TimeSpan?lockDuration      = null
                                                             )
        {
            if (!conn.NamespaceManager.QueueExists(name))
            {
                try
                {
                    return(conn.NamespaceManager.CreateQueue(QueueDescriptionGet(name, defaultMessageTTL, lockDuration)));
                }
                catch (MessagingEntityAlreadyExistsException)
                {
                    // Another service created it before we did - just retrieve the one it created
                }
            }

            return(conn.NamespaceManager.GetQueue(name));
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method creates the subscription if it does not exist.
        /// </summary>
        public static SubscriptionDescription SubscriptionFabricInitialize(this AzureConnection conn, string name, string subscriptionId
                                                                           , TimeSpan?autoDeleteSubscription = null
                                                                           , TimeSpan?defaultMessageTTL      = null
                                                                           , TimeSpan?lockDuration           = null)
        {
            if (!conn.NamespaceManager.SubscriptionExists(name, subscriptionId))
            {
                try
                {
                    return(conn.NamespaceManager.CreateSubscription(
                               SubscriptionDescriptionGet(name, subscriptionId, autoDeleteSubscription, defaultMessageTTL, lockDuration)
                               ));
                }
                catch (MessagingEntityAlreadyExistsException)
                {
                    // Another service created it before we did - just retrieve the one it created
                }
            }

            return(conn.NamespaceManager.GetSubscription(name, subscriptionId));
        }