Exemplo n.º 1
0
        public static Command CreateCommand()
        {
            var command = new Command("migrate-to-quorum", "Migrate an existing classic queue to a quorum queue.");

            var queueNameArgument = new Argument <string>()
            {
                Name        = "queueName",
                Description = "Specify the name of the queue to migrate"
            };
            var connectionFactoryBinder = SharedOptions.CreateConnectionFactoryBinderWithOptions(command);

            command.AddArgument(queueNameArgument);

            command.SetHandler(async(queueName, connectionFactory, console, cancellationToken) =>
            {
                var migrateCommand = new QueueMigrateCommand(queueName, connectionFactory, console);
                await migrateCommand.Run(cancellationToken).ConfigureAwait(false);
            },
                               queueNameArgument, connectionFactoryBinder, Bind.FromServiceProvider <IConsole>(), Bind.FromServiceProvider <CancellationToken>());

            return(command);
        }
Exemplo n.º 2
0
        public static Command CreateCommand()
        {
            var command = new Command("verify", "Verify broker pre-requisites for using the delay infrastructure v2.");

            var urlOption = new Option <string>("--url", "Specifies the url to the RabbitMQ management api")
            {
                IsRequired = true
            };

            var usernameOption = new Option <string>("--username", "Specifies the username for accessing the RabbitMQ management api")
            {
                IsRequired = true
            };

            var passwordOption = new Option <string>("--password", "Specifies the password for acessing the RabbitMQ management api")
            {
                IsRequired = true
            };

            command.AddOption(urlOption);
            command.AddOption(usernameOption);
            command.AddOption(passwordOption);

            command.SetHandler(async(url, username, password, console, cancellationToken) =>
            {
                var delaysVerify = new DelaysVerifyCommand(url, username, password, console);
                await delaysVerify.Run(cancellationToken).ConfigureAwait(false);
            },
                               urlOption, usernameOption, passwordOption, Bind.FromServiceProvider <IConsole>(), Bind.FromServiceProvider <CancellationToken>());

            return(command);
        }
Exemplo n.º 3
0
        public static Command CreateCommand()
        {
            var command = new Command("migrate", "Migrate in-flight delayed messages to the delay infrustructure v2.");

            var connectionFactoryBinder = SharedOptions.CreateConnectionFactoryBinderWithOptions(command);
            var routingTopologyBinder   = SharedOptions.CreateRoutingTopologyBinderWithOptions(command);

            var quietModeOption = new Option <bool>(name: "--Quiet", description: $"Disable console output while running");

            quietModeOption.AddAlias("-q");

            command.AddOption(quietModeOption);

            command.SetHandler(async(connectionFactory, routingTopology, quietMode, console, cancellationToken) =>
            {
                var delaysMigrate = new DelaysMigrateCommand(connectionFactory, routingTopology, quietMode, console);
                await delaysMigrate.Run(cancellationToken).ConfigureAwait(false);
            },
                               connectionFactoryBinder, routingTopologyBinder, quietModeOption, Bind.FromServiceProvider <IConsole>(), Bind.FromServiceProvider <CancellationToken>());

            return(command);
        }
Exemplo n.º 4
0
        public static Command CreateCommand()
        {
            var command = new Command("create", "Create delay infrastructure v2 queues and exchanges");

            var connectionFactoryBinder = SharedOptions.CreateConnectionFactoryBinderWithOptions(command);

            command.SetHandler(async(connectionFactory, console, cancellationToken) =>
            {
                var delaysCreate = new DelaysCreateCommand(connectionFactory, console);
                await delaysCreate.Run(cancellationToken).ConfigureAwait(false);
            },
                               connectionFactoryBinder, Bind.FromServiceProvider <IConsole>(), Bind.FromServiceProvider <CancellationToken>());

            return(command);
        }
Exemplo n.º 5
0
        public static Command CreateCommand()
        {
            var command = new Command("create", "Creates queues and exchanges for an endpoint based on a routing topology");

            var endpointNameArgument = new Argument <string>(
                name: "endpointName",
                description: "Specifies the name of the endpoint to create");

            var errorQueueOption = new Option <string>(
                name: "--errorQueueName",
                description: "Specifies that an error queue with the specified name should be created");

            var auditQueueOption = new Option <string>(
                name: "--auditQueueName",
                description: "Specifies that an audit queue with the specified name should be created");

            var instanceDiscriminatorsOption = new Option <IEnumerable <string> >(
                name: "--instanceDiscriminators",
                description: "Specifies a list of instance discriminators to use when the endpoint needs uniquely addressable instances")
            {
                Arity = ArgumentArity.ZeroOrMore,
                AllowMultipleArgumentsPerToken = true
            };

            var connectionFactoryBinder = SharedOptions.CreateConnectionFactoryBinderWithOptions(command);
            var routingTopologyBinder   = SharedOptions.CreateRoutingTopologyBinderWithOptions(command);

            command.AddArgument(endpointNameArgument);
            command.AddOption(errorQueueOption);
            command.AddOption(auditQueueOption);
            command.AddOption(instanceDiscriminatorsOption);

            command.SetHandler(async(endpointName, errorQueue, auditQueue, instanceDiscriminators, connectionFactory, routingTopology, console, cancellationToken) =>
            {
                var queueCreate = new EndpointCreateCommand(connectionFactory, routingTopology, console);
                await queueCreate.Run(endpointName, errorQueue, auditQueue, instanceDiscriminators, cancellationToken).ConfigureAwait(false);
            },
                               endpointNameArgument, errorQueueOption, auditQueueOption, instanceDiscriminatorsOption, connectionFactoryBinder, routingTopologyBinder, Bind.FromServiceProvider <IConsole>(), Bind.FromServiceProvider <CancellationToken>());

            return(command);
        }