コード例 #1
0
ファイル: Topic.cs プロジェクト: netcorepal/aliyun.mns
 /// <inheritdoc/>
 public SetTopicAttributesResponse SetAttributes(TopicAttributes attributes)
 {
     return(AggregateExceptionExtract.Extract(() =>
     {
         return SetAttributesAsync(attributes).Result;
     }));
 }
コード例 #2
0
ファイル: Topic.cs プロジェクト: EsonXie/Aliyun.MNS.Standrad
        /// <inheritdoc/>
        public SetTopicAttributesResponse SetAttributes(TopicAttributes attributes)
        {
            var request = new SetTopicAttributesRequest {
                Attributes = attributes
            };

            return(SetAttributes(request));
        }
コード例 #3
0
ファイル: Topic.cs プロジェクト: netcorepal/aliyun.mns
        public async Task <SetTopicAttributesResponse> SetAttributesAsync(TopicAttributes attributes)
        {
            var request = new SetTopicAttributesRequest {
                Attributes = attributes
            };

            return(await SetAttributesAsync(request).ConfigureAwait(false));
        }
        public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            XmlTextReader   reader     = new XmlTextReader(context.ResponseStream);
            TopicAttributes attributes = new TopicAttributes();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    switch (reader.LocalName)
                    {
                    case MNSConstants.XML_ELEMENT_TOPIC_NAME:
                        reader.Read();
                        attributes.TopicName = reader.Value;
                        break;

                    case MNSConstants.XML_ELEMENT_CREATE_TIME:
                        reader.Read();
                        attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000);
                        break;

                    case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME:
                        reader.Read();
                        attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000);
                        break;

                    case MNSConstants.XML_ELEMENT_MAXIMUM_MESSAGE_SIZE:
                        reader.Read();
                        attributes.MaximumMessageSize = uint.Parse(reader.Value);
                        break;

                    case MNSConstants.XML_ELEMENT_MESSAGE_RETENTION_PERIOD:
                        reader.Read();
                        attributes.MessageRetentionPeriod = uint.Parse(reader.Value);
                        break;

                    case MNSConstants.XML_ELEMENT_MESSAGE_COUNT:
                        reader.Read();
                        attributes.MessageCount = uint.Parse(reader.Value);
                        break;

                    case MNSConstants.XML_ELEMENT_LOGGING_ENABLED:
                        reader.Read();
                        attributes.LoggingEnabled = bool.Parse(reader.Value);
                        break;
                    }
                    break;
                }
            }
            reader.Close();
            return(new GetTopicAttributesResponse()
            {
                Attributes = attributes
            });
        }
コード例 #5
0
 public override string ToString()
 {
     return(string.Join(", ", new[]
     {
         $"name: {EntityName}",
         Durable ? "durable" : "",
         AutoDelete ? "auto-delete" : "",
         TopicAttributes.Any() ? $"attributes: {string.Join(";", TopicAttributes.Select(a => $"{a.Key}={a.Value}"))}" : "",
         TopicSubscriptionAttributes.Any() ? $"subscription-attributes: {string.Join(";", TopicSubscriptionAttributes.Select(a => $"{a.Key}={a.Value}"))}" : ""
     }.Where(x => !string.IsNullOrWhiteSpace(x))));
 }
コード例 #6
0
 public override void ExecuteCmdlet()
 {
     if (!string.IsNullOrEmpty(Name))
     {
         TopicAttributes topicAttributes = Client.GetTopic(ResourceGroupName, Namespace, Name);
         WriteObject(topicAttributes);
     }
     else
     {
         IEnumerable <TopicAttributes> topicAttributes = Client.ListTopics(ResourceGroupName, Namespace);
         WriteObject(topicAttributes, true);
     }
 }
コード例 #7
0
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            if (InputObject != null)
            {
                topicAttributes = InputObject;
            }
            else
            {
                //topicAttributes = TopicObj;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateTopic, Name, Namespace)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, topicAttributes.Name, topicAttributes));
            }
        }
コード例 #8
0
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            if (TopicObj != null)
            {
                topicAttributes = TopicObj;
            }
            else
            {
                //topicAttributes = TopicObj;
            }

            if (ShouldProcess(target: TopicName, action: string.Format("Update Topic:{0} of NameSpace:{1}", TopicName, NamespaceName)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroup, NamespaceName, topicAttributes.Name, topicAttributes));
            }
        }
コード例 #9
0
        public TopicAttributes CreateUpdateTopic(string resourceGroupName, string namespaceName, string topicName, TopicAttributes topic)
        {
            var parameters = new TopicCreateOrUpdateParameters()
            {
                AutoDeleteOnIdle                    = topic.AutoDeleteOnIdle,
                EntityAvailabilityStatus            = topic.EntityAvailabilityStatus,
                DefaultMessageTimeToLive            = topic.DefaultMessageTimeToLive,
                DuplicateDetectionHistoryTimeWindow = topic.DuplicateDetectionHistoryTimeWindow,
                EnableBatchedOperations             = topic.EnableBatchedOperations,
                EnableExpress                     = topic.EnableExpress,
                EnablePartitioning                = topic.EnablePartitioning,
                EnableSubscriptionPartitioning    = topic.EnableSubscriptionPartitioning,
                FilteringMessagesBeforePublishing = topic.FilteringMessagesBeforePublishing,
                IsAnonymousAccessible             = topic.IsAnonymousAccessible,
                IsExpress                  = topic.IsExpress,
                MaxSizeInMegabytes         = topic.MaxSizeInMegabytes,
                RequiresDuplicateDetection = topic.RequiresDuplicateDetection,
                Status          = topic.Status,
                SupportOrdering = topic.SupportOrdering,
                Location        = topic.Location
            };

            var response = Client.Topics.CreateOrUpdate(resourceGroupName, namespaceName, topicName, parameters);

            return(new TopicAttributes(response));
        }
コード例 #10
0
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace);

            topicAttributes.Name = Name;

            if (EnablePartitioning != null)
            {
                topicAttributes.EnablePartitioning = EnablePartitioning;
            }


            if (AutoDeleteOnIdle != null)
            {
                topicAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                topicAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (DuplicateDetectionHistoryTimeWindow != null)
            {
                topicAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow;
            }


            if (EnableBatchedOperations != null)
            {
                topicAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }



            if (EnableExpress != null)
            {
                topicAttributes.EnableExpress = EnableExpress;
            }


            if (MaxSizeInMegabytes != null)
            {
                topicAttributes.MaxSizeInMegabytes = (int?)MaxSizeInMegabytes;
            }

            if (RequiresDuplicateDetection != null)
            {
                topicAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection;
            }

            if (SupportOrdering != null)
            {
                topicAttributes.SupportOrdering = SupportOrdering;
            }

            if (SizeInBytes != null)
            {
                topicAttributes.SizeInBytes = SizeInBytes;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateTopic, Name, Namespace)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, Name, topicAttributes));
            }
        }
コード例 #11
0
 /// <summary>
 /// Instantiates SetTopicAttributesRequest with the parameterized properties
 /// </summary>
 /// <param name="attributes">The topic attributes to set.</param>
 public SetTopicAttributesRequest(TopicAttributes attributes)
 {
     _attributes = attributes;
 }
コード例 #12
0
        public void SetAttributesTest()
        {
            Topic topic = client.GetNativeTopic("UTTopic");

            var resp = topic.GetAttributes();
            var originalLoggingEnabled = resp.Attributes.LoggingEnabled;

            TopicAttributes qa = new TopicAttributes();

            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(originalLoggingEnabled, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes();
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = true
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes();
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = true
            };
            var req = new CreateTopicRequest()
            {
                TopicName = "UTTopic2", Attributes = qa
            };
            Topic topic2 = client.CreateTopic(req);

            resp = topic2.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            client.DeleteTopic("UTTopic2");

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            req = new CreateTopicRequest()
            {
                TopicName = "UTTopic2", Attributes = qa
            };
            topic2 = client.CreateTopic(req);
            resp   = topic2.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);
        }
コード例 #13
0
        static void Main(string[] args)
        {
            var config = Newtonsoft.Json.JsonConvert.DeserializeObject <ConfigModel>(File.ReadAllText(@"E:\MNS.json"));

            _accessKeyId     = config.AccessKeyId;
            _secretAccessKey = config.AccessKey;
            _endpoint        = config.EndPoint;

            #region Topic Releated Test Cases

            IMNS client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint);

            /* 1.1. Create queue */
            var createTopicRequest = new CreateTopicRequest
            {
                TopicName = _topicName
            };

            Topic topic = null;
            try
            {
                client.DeleteTopic(_topicName);
                topic = client.CreateTopic(createTopicRequest);
                Console.WriteLine("Create topic successfully, topic name: {0}", topic.TopicName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create topic failed, exception info: " + ex.Message);
                return;
            }

            topic = client.GetNativeTopic(_topicName);
            try
            {
                ListTopicResponse res = client.ListTopic(null, null, 10);
                Console.WriteLine("List topic successfully, topic name: {0}", _topicName);
                foreach (String topicUrl in res.TopicUrls)
                {
                    Console.WriteLine(topicUrl);
                }
                if (res.NextMarker != null)
                {
                    Console.WriteLine("NextMarker: " + res.NextMarker);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Delete topic failed, exception info: " + ex.Message);
            }

            try
            {
                GetTopicAttributesResponse res = topic.GetAttributes();
                Console.WriteLine("GetTopicAttributes, topic name: {0}", _topicName);
                Console.WriteLine(res.Attributes.CreateTime);
                Console.WriteLine(res.Attributes.LastModifyTime);
                Console.WriteLine(res.Attributes.MaximumMessageSize);
                Console.WriteLine(res.Attributes.MessageRetentionPeriod);
                Console.WriteLine(res.Attributes.LoggingEnabled);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GetTopicAttributes failed, exception info: " + ex.Message);
            }

            try
            {
                TopicAttributes attributes = new TopicAttributes()
                {
                    MaximumMessageSize = 2048
                };
                topic.SetAttributes(attributes);
                Console.WriteLine("SetTopicAttributes succeed, topic name: {0}", _topicName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SetTopicAttributes failed, exception info: " + ex.Message + ex.GetType().Name);
            }

            try
            {
                SubscribeResponse res = topic.Subscribe(_subscriptionName, "http://XXXX");
                Console.WriteLine("Subscribe, subscriptionUrl: {0}", res.SubscriptionUrl);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Subscribe failed, exception info: " + ex.Message);
            }

            try
            {
                GetSubscriptionAttributeResponse res = topic.GetSubscriptionAttribute(_subscriptionName);
                Console.WriteLine("GetSubscriptionAttributeResponse, subs name: {0}", _subscriptionName);
                Console.WriteLine(res.Attributes.CreateTime);
                Console.WriteLine(res.Attributes.LastModifyTime);
                Console.WriteLine(res.Attributes.TopicName);
                Console.WriteLine(res.Attributes.TopicOwner);
                Console.WriteLine(res.Attributes.EndPoint);
                Console.WriteLine(res.Attributes.Strategy);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GetSubscriptionAttribute failed, exception info: " + ex.Message);
            }

            try
            {
                SubscriptionAttributes attributes = new SubscriptionAttributes()
                {
                    Strategy = SubscriptionAttributes.NotifyStrategy.EXPONENTIAL_DECAY_RETRY
                };
                topic.SetSubscriptionAttribute(_subscriptionName, attributes);
                Console.WriteLine("SetSubscriptionAttribute succeed, topic name: {0}", _topicName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SetSubscriptionAttribute failed, exception info: " + ex.Message + ex.GetType().Name);
            }

            try
            {
                GetSubscriptionAttributeResponse res = topic.GetSubscriptionAttribute(_subscriptionName);
                Console.WriteLine("GetSubscriptionAttributeResponse, subs name: {0}", _subscriptionName);
                Console.WriteLine(res.Attributes.CreateTime);
                Console.WriteLine(res.Attributes.LastModifyTime);
                Console.WriteLine(res.Attributes.TopicName);
                Console.WriteLine(res.Attributes.TopicOwner);
                Console.WriteLine(res.Attributes.EndPoint);
                Console.WriteLine(res.Attributes.Strategy);
                Console.WriteLine(res.Attributes.ContentFormat);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GetSubscriptionAttribute failed, exception info: " + ex.Message);
            }

            try
            {
                ListSubscriptionResponse res = topic.ListSubscription("");
                Console.WriteLine("ListSubscription successfully, topic name: {0}", _topicName);
                foreach (String subscriptionUrl in res.SubscriptionUrls)
                {
                    Console.WriteLine(subscriptionUrl);
                }
                if (res.NextMarker != null)
                {
                    Console.WriteLine("NextMarker: " + res.NextMarker);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ListSubscription failed, exception info: " + ex.Message);
            }

            try
            {
                var response = topic.PublishMessage("message here </asdas\">");
                Console.WriteLine("PublishMessage succeed! " + response.MessageId);
            }
            catch (Exception ex)
            {
                Console.WriteLine("PublishMessage failed, exception info: " + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            try
            {
                topic.Unsubscribe(_subscriptionName);
                Console.WriteLine("Unsubscribe succeed!");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Subscribe failed, exception info: " + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            //// PUBLISH MESSAGE for SMS
            //try
            //{
            //    var res = topic.Subscribe(_subscriptionName + "batchsms", topic.GenerateBatchSmsEndpoint());
            //    Console.WriteLine(res.SubscriptionUrl);

            //    PublishMessageRequest request = new PublishMessageRequest();
            //    MessageAttributes messageAttributes = new MessageAttributes();
            //    BatchSmsAttributes batchSmsAttributes = new BatchSmsAttributes();
            //    batchSmsAttributes.FreeSignName = "陈舟锋";
            //    batchSmsAttributes.TemplateCode = "SMS_15535414";
            //    Dictionary<string, string> param = new Dictionary<string, string>();
            //    param.Add("name", "CSharpBatch");
            //    batchSmsAttributes.AddReceiver("13735576932", param);

            //    messageAttributes.BatchSmsAttributes = batchSmsAttributes;
            //    request.MessageAttributes = messageAttributes;
            //    request.MessageBody = "</asdas\">";
            //    PublishMessageResponse resp = topic.PublishMessage(request);

            //    Console.WriteLine(resp.MessageId);

            //    // check sms
            //    System.Threading.Thread.Sleep(3000);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Subscribe failed, exception info: " + ex.Message);
            //}

            //// PUBLISH MESSAGE for SMS
            //try
            //{
            //    var res = topic.Subscribe(_subscriptionName + "singlesms", topic.GenerateSmsEndpoint());
            //    Console.WriteLine(res.SubscriptionUrl);

            //    PublishMessageRequest request = new PublishMessageRequest();
            //    MessageAttributes messageAttributes = new MessageAttributes();
            //    SmsAttributes smsAttributes = new SmsAttributes();
            //    smsAttributes.FreeSignName = "陈舟锋";
            //    smsAttributes.TemplateCode = "SMS_15535414";
            //    Dictionary<string, string> param = new Dictionary<string, string>();
            //    param.Add("name", "CSharpSingle");
            //    smsAttributes.Receiver = "13735576932";
            //    smsAttributes.SmsParams = param;

            //    messageAttributes.SmsAttributes = smsAttributes;
            //    request.MessageAttributes = messageAttributes;
            //    request.MessageBody = "</asdas\">";
            //    PublishMessageResponse resp = topic.PublishMessage(request);

            //    Console.WriteLine(resp.MessageId);

            //    // check sms
            //    System.Threading.Thread.Sleep(3000);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Subscribe failed, exception info: " + ex.Message);
            //}

            //// PUBLISH MESSAGE TO QUEUE AND MAIL
            //string queueName = "TestQueueNameHere";
            //try
            //{
            //    var queue = client.CreateQueue(queueName);

            //    var res = topic.Subscribe(_subscriptionName, topic.GenerateMailEndpoint("*****@*****.**"));
            //    // res = topic.Subscribe(_subscriptionName + "2", topic.GenerateQueueEndpoint(queueName));
            //    res = topic.Subscribe(new SubscribeRequest(_subscriptionName + "2", topic.GenerateQueueEndpoint(queueName), "TAG", SubscriptionAttributes.NotifyStrategy.BACKOFF_RETRY, SubscriptionAttributes.NotifyContentFormat.JSON));

            //    PublishMessageRequest request = new PublishMessageRequest();
            //    MessageAttributes messageAttributes = new MessageAttributes();
            //    MailAttributes mailAttributes = new MailAttributes();
            //    mailAttributes.AccountName = "*****@*****.**";
            //    mailAttributes.Subject = "TestMail C#";
            //    mailAttributes.IsHtml = false;
            //    mailAttributes.ReplyToAddress = false;
            //    mailAttributes.AddressType = 0;
            //    messageAttributes.MailAttributes = mailAttributes;
            //    request.MessageAttributes = messageAttributes;
            //    request.MessageTag = "TAG";
            //    request.MessageBody = "message here2222 </asdas\">";
            //    topic.PublishMessage(request);

            //    var resp = queue.ReceiveMessage(30);
            //    Console.WriteLine(resp.Message.Body);

            //    // check mailbox
            //    System.Threading.Thread.Sleep(3000);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Subscribe failed, exception info: " + ex.Message);
            //}

            //try
            //{
            //    client.DeleteQueue(queueName);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Delete queue failed, exception info: " + ex.Message);
            //}

            try
            {
                client.DeleteTopic(_topicName);
                Console.WriteLine("Delete topic successfully, topic name: {0}", _topicName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Delete topic failed, exception info: " + ex.Message);
            }
            #endregion

            Console.ReadKey();
        }
コード例 #14
0
        public TopicAttributes CreateUpdateTopic(string resourceGroupName, string namespaceName, string topicName, TopicAttributes topic)
        {
            var parameters = new SBTopic();

            if (topic.AutoDeleteOnIdle != null)
            {
                parameters.AutoDeleteOnIdle = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.AutoDeleteOnIdle);
            }
            if (topic.DefaultMessageTimeToLive != null)
            {
                parameters.DefaultMessageTimeToLive = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.DefaultMessageTimeToLive);
            }
            if (topic.DuplicateDetectionHistoryTimeWindow != null)
            {
                parameters.DuplicateDetectionHistoryTimeWindow = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.DuplicateDetectionHistoryTimeWindow);
            }
            if (topic.EnableBatchedOperations != null)
            {
                parameters.EnableBatchedOperations = topic.EnableBatchedOperations;
            }
            if (topic.EnableExpress != null)
            {
                parameters.EnableExpress = topic.EnableExpress;
            }
            if (topic.EnablePartitioning != null)
            {
                parameters.EnablePartitioning = topic.EnablePartitioning;
            }
            if (topic.MaxSizeInMegabytes != null)
            {
                parameters.MaxSizeInMegabytes = topic.MaxSizeInMegabytes;
            }
            if (topic.RequiresDuplicateDetection != null)
            {
                parameters.RequiresDuplicateDetection = topic.RequiresDuplicateDetection;
            }
            if (topic.Status != null)
            {
                parameters.Status = topic.Status;
            }
            if (topic.SupportOrdering != null)
            {
                parameters.SupportOrdering = topic.SupportOrdering;
            }

            var response = Client.Topics.CreateOrUpdate(resourceGroupName, namespaceName, topicName, parameters);

            return(new TopicAttributes(response));
        }
コード例 #15
0
 /// <summary>
 /// Instantiates CreateTopicRequest with the parameterized properties
 /// </summary>
 /// <param name="queueName">The name for the topic to be created.</param>
 /// <param name="attributes">The queue attributes to be set.</param>
 public CreateTopicRequest(string topicName, TopicAttributes attributes)
 {
     _topicName  = topicName;
     _attributes = attributes;
 }
コード例 #16
0
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroup, NamespaceName);

            topicAttributes.Location = getNamespaceLoc.Location;

            topicAttributes.Name = TopicName;

            if (EnablePartitioning != null)
            {
                topicAttributes.EnablePartitioning = EnablePartitioning;
            }


            if (AutoDeleteOnIdle != null)
            {
                topicAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                topicAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (DuplicateDetectionHistoryTimeWindow != null)
            {
                topicAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow;
            }


            if (EnableBatchedOperations != null)
            {
                topicAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }

            if (EnableSubscriptionPartitioning != null)
            {
                topicAttributes.EnableSubscriptionPartitioning = EnableSubscriptionPartitioning;
            }

            if (EnableExpress != null)
            {
                topicAttributes.EnableExpress = EnableExpress;
            }

            if (FilteringMessagesBeforePublishing != null)
            {
                topicAttributes.FilteringMessagesBeforePublishing = FilteringMessagesBeforePublishing;
            }

            if (IsAnonymousAccessible != null)
            {
                topicAttributes.IsAnonymousAccessible = IsAnonymousAccessible;
            }

            if (IsExpress != null)
            {
                topicAttributes.IsExpress = IsExpress;
            }

            if (MaxSizeInMegabytes != null)
            {
                topicAttributes.MaxSizeInMegabytes = MaxSizeInMegabytes;
            }

            if (RequiresDuplicateDetection != null)
            {
                topicAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection;
            }

            if (SupportOrdering != null)
            {
                topicAttributes.SupportOrdering = SupportOrdering;
            }

            if (SizeInBytes != null)
            {
                topicAttributes.SizeInBytes = SizeInBytes;
            }


            if (ShouldProcess(target: TopicName, action: string.Format("Create a new Topic:{0} for Namespace:{1}", TopicName, NamespaceName)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroup, NamespaceName, topicAttributes.Name, topicAttributes));
            }
        }