CreateQueue( CreateQueueCommandModel createQueueModel) { if (createQueueModel == null) throw new ArgumentNullException(nameof(createQueueModel)); var queue = await SlinqyQueueClient.CreateQueueAsync( queueName: createQueueModel.QueueName, shardIndexPadding: 4 ); var monitor = new SlinqyQueueShardMonitor( createQueueModel.QueueName, PhysicalQueueService ); slinqyAgent = new SlinqyAgent( PhysicalQueueService, monitor, createQueueModel.StorageCapacityScaleOutThresholdPercentage / 100D ); await slinqyAgent.Start(); return new QueueInformationViewModel( queue.Name, queue.MaxQueueSizeMegabytes, queue.CurrentQueueSizeBytes ); }
Index() { var serviceBusNamespaceManager = NamespaceManager.CreateFromConnectionString( ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"] ); this.ViewBag.Title = "Home Page"; this.ViewBag.ServiceBusNamespace = serviceBusNamespaceManager.Address.ToString(); var defaultValues = new CreateQueueCommandModel { MaxQueueSizeMegabytes = 1024, StorageCapacityScaleOutThresholdPercentage = 1 }; return(this.View(defaultValues)); }
Index() { var serviceBusNamespaceManager = NamespaceManager.CreateFromConnectionString( ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"] ); this.ViewBag.Title = "Home Page"; this.ViewBag.ServiceBusNamespace = serviceBusNamespaceManager.Address.ToString(); var defaultValues = new CreateQueueCommandModel { MaxQueueSizeMegabytes = 1024, StorageCapacityScaleOutThresholdPercentage = 1 }; return this.View(defaultValues); }
CreateQueue( CreateQueueCommandModel createQueueModel) { if (createQueueModel == null) { throw new ArgumentNullException(nameof(createQueueModel)); } if (!this.ModelState.IsValid) { return(this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState)); } var monitor = new SlinqyQueueShardMonitor( createQueueModel.QueueName, PhysicalQueueService ); slinqyAgent = new SlinqyAgent( PhysicalQueueService, monitor, createQueueModel.StorageCapacityScaleOutThresholdPercentage / 100D, 4 ); await slinqyAgent.Start(); SlinqyQueues.Add( createQueueModel.QueueName, new SlinqyQueue(monitor) ); var response = new HttpResponseMessage(HttpStatusCode.Created) { Content = new ObjectContent <QueueInformationViewModel>( new QueueInformationViewModel( queueName: createQueueModel.QueueName, maxQueueSizeMegabytes: createQueueModel.MaxQueueSizeMegabytes, currentQueueSizeBytes: 0 ), new JsonMediaTypeFormatter() ) }; return(response); }
CreateQueue( CreateQueueCommandModel createQueueModel) { if (createQueueModel == null) throw new ArgumentNullException(nameof(createQueueModel)); if (!this.ModelState.IsValid) return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState); var monitor = new SlinqyQueueShardMonitor( createQueueModel.QueueName, PhysicalQueueService ); slinqyAgent = new SlinqyAgent( PhysicalQueueService, monitor, createQueueModel.StorageCapacityScaleOutThresholdPercentage / 100D, 4 ); await slinqyAgent.Start(); SlinqyQueues.Add( createQueueModel.QueueName, new SlinqyQueue(monitor) ); var response = new HttpResponseMessage(HttpStatusCode.Created) { Content = new ObjectContent<QueueInformationViewModel>( new QueueInformationViewModel( queueName: createQueueModel.QueueName, maxQueueSizeMegabytes: createQueueModel.MaxQueueSizeMegabytes, currentQueueSizeBytes: 0 ), new JsonMediaTypeFormatter() ) }; return response; }