Example #1
0
        CreateQueueAsync(
            string  queueName,
            int     shardIndexPadding)
        {
            if (string.IsNullOrWhiteSpace(queueName))
                throw new ArgumentNullException(nameof(queueName));

            var queueShardName = SlinqyQueueShard.GenerateFirstShardName(
                slinqyQueueName:    queueName,
                shardIndexPadding:  shardIndexPadding
            );

            // Call the function to create the first physical queue shard to establish the virtual queue.
            // No need to do anything with the returned shard...
            var shard = await this.physicalQueueService
                .CreateQueue(queueShardName)
                .ConfigureAwait(false);

            var shardMonitor = new SlinqyQueueShardMonitor(
                queueName,
                this.physicalQueueService
            );

            await shardMonitor
                .Start()
                .ConfigureAwait(false);

            var queue = new SlinqyQueue(
                shardMonitor
            );

            this.slinqyQueues.TryAdd(queueName, queue);

            return queue;
        }
Example #2
0
        CreateQueueAsync(
            string queueName,
            int shardIndexPadding)
        {
            // TODO: Refactor - Much of this functionality overlaps with the Agent,
            //       let Agent create first shard too and remove this code.
            if (string.IsNullOrWhiteSpace(queueName))
            {
                throw new ArgumentNullException(nameof(queueName));
            }

            var queueShardName = SlinqyQueueShard.GenerateFirstShardName(
                slinqyQueueName:    queueName,
                shardIndexPadding:  shardIndexPadding
                );

            // Call the function to create the first physical queue shard to establish the virtual queue.
            // No need to do anything with the returned shard...
            var shard = await this.physicalQueueService
                        .CreateQueue(queueShardName)
                        .ConfigureAwait(false);

            var shardMonitor = new SlinqyQueueShardMonitor(
                queueName,
                this.physicalQueueService
                );

            await shardMonitor
            .Start()
            .ConfigureAwait(false);

            var queue = new SlinqyQueue(
                shardMonitor
                );

            this.slinqyQueues.TryAdd(queueName, queue);

            return(queue);
        }