rabbitmq-server/deps/rabbitmq_cli/README.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

128 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

# RabbitMQ CLI Tools
2016-02-03 02:54:36 +08:00
This repository contains [RabbitMQ CLI tools](https://rabbitmq.com/cli.html) ([rabbitmqctl](https://www.rabbitmq.com/man/rabbitmqctl.1.man.html) and
others).
2016-02-03 02:54:36 +08:00
This generation of CLI tools first shipped with RabbitMQ `3.7.0`.
2016-02-04 00:13:02 +08:00
2016-11-04 22:03:33 +08:00
## Goals
Team RabbitMQ wanted a set of tools that
* Was extensible from/with plugins
* Supported pluggable output formats (in particular machine-friendly ones)
* Had good test coverage
* Wasn't as coupled to the server repository
URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated: ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException). * http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException). * http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException). * http://e2project.org (200) with 1 occurrences could not be migrated: ([https](https://e2project.org) result AnnotatedConnectException). * http://erlang.org/doc/reference_manual/distributed.html (200) with 1 occurrences could not be migrated: ([https](https://erlang.org/doc/reference_manual/distributed.html) result ConnectTimeoutException). * http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated: ([https](https://nitrogenproject.com/) result ConnectTimeoutException). * http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated: ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException). * http://yaws.hyber.org (200) with 1 occurrences could not be migrated: ([https](https://yaws.hyber.org) result AnnotatedConnectException). * http://choven.ca (503) with 1 occurrences could not be migrated: ([https](https://choven.ca) result ConnectTimeoutException). # Fixed URLs ## Fixed But Review Recommended These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended. * http://fixprotocol.org/ (301) with 1 occurrences migrated to: https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException). * http://erldb.org (UnknownHostException) with 1 occurrences migrated to: https://erldb.org ([https](https://erldb.org) result UnknownHostException). * http://elixir-lang.org/docs/stable/elixir/OptionParser.html (301) with 1 occurrences migrated to: https://elixir-lang.org/docs/stable/elixir/OptionParser.html ([https](https://elixir-lang.org/docs/stable/elixir/OptionParser.html) result 404). * http://elixir-lang.org/docs/stable/elixir/Stream.html (301) with 1 occurrences migrated to: https://elixir-lang.org/docs/stable/elixir/Stream.html ([https](https://elixir-lang.org/docs/stable/elixir/Stream.html) result 404). ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://cloudi.org/ with 27 occurrences migrated to: https://cloudi.org/ ([https](https://cloudi.org/) result 200). * http://elixir-lang.org with 1 occurrences migrated to: https://elixir-lang.org ([https](https://elixir-lang.org) result 200). * http://elixir-lang.org/ with 2 occurrences migrated to: https://elixir-lang.org/ ([https](https://elixir-lang.org/) result 200). * http://elixir-lang.org/getting-started/typespecs-and-behaviours.html with 1 occurrences migrated to: https://elixir-lang.org/getting-started/typespecs-and-behaviours.html ([https](https://elixir-lang.org/getting-started/typespecs-and-behaviours.html) result 200). * http://elixir-lang.org/install.html with 1 occurrences migrated to: https://elixir-lang.org/install.html ([https](https://elixir-lang.org/install.html) result 200). * http://erlware.org/ with 1 occurrences migrated to: https://erlware.org/ ([https](https://erlware.org/) result 200). * http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to: https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200). * http://ninenines.eu with 6 occurrences migrated to: https://ninenines.eu ([https](https://ninenines.eu) result 200). * http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 1 occurrences migrated to: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200). * http://www.actordb.com/ with 2 occurrences migrated to: https://www.actordb.com/ ([https](https://www.actordb.com/) result 200). * http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to: https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200). * http://www.rebar3.org with 1 occurrences migrated to: https://www.rebar3.org ([https](https://www.rebar3.org) result 200). * http://contributor-covenant.org with 1 occurrences migrated to: https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301). * http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to: https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301). * http://inaka.github.com/apns4erl with 1 occurrences migrated to: https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301). * http://inaka.github.com/edis/ with 1 occurrences migrated to: https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301). * http://lasp-lang.org/ with 1 occurrences migrated to: https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301). * http://rabbitmq.com/documentation.html with 1 occurrences migrated to: https://rabbitmq.com/documentation.html ([https](https://rabbitmq.com/documentation.html) result 301). * http://saleyn.github.com/erlexec with 1 occurrences migrated to: https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301). * http://www.mozilla.org/MPL/ with 290 occurrences migrated to: https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301). * http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to: https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301).
2019-03-20 16:13:07 +08:00
* Could be used as a low risk vehicle for [Elixir](https://elixir-lang.org) evaluation
2016-11-04 22:03:33 +08:00
## Supported RabbitMQ Versions
Long lived branches in this repository track the same branch in RabbitMQ core and related
repositories. So `master` tracks `master` in rabbitmq-server, `v3.10.x` tracks branch `v3.10.x` in
rabbitmq-server and so on.
Please use the version of CLI tools that come with the RabbitMQ distribution version installed.
2016-02-04 00:13:02 +08:00
## Building
### Requirements
Building this project requires
* Erlang/OTP 23.3 (or later)
* [Elixir](https://elixir-lang.org/) 1.12.0 (or later).
2016-11-03 20:27:29 +08:00
Command line tools depend on [rabbitmq-common](https://github.com/rabbitmq/rabbitmq-common).
Dependencies are being resolved by `erlang.mk`
2016-05-24 17:41:15 +08:00
### Building Standalone Executables
2017-04-08 17:07:03 +08:00
This repo produces a `rabbitmqctl` executable which can be used as different tools
(`rabbitmq-plugins`, `rabbitmq-diagnostics`, `rabbitmq-queues`, `rabbitmq-streams`, `rabbitmq-upgrade`) by copying or symlinking it with different names.
2017-06-30 15:27:56 +08:00
Depending on the name, a different set of commands will be loaded and available, including
for `--help`.
2016-11-03 20:27:29 +08:00
To generate the executable, run
```
2016-11-04 22:03:33 +08:00
make
```
## Usage
2016-05-24 17:41:15 +08:00
### `rabbitmqctl`
2019-04-01 18:54:04 +08:00
See `rabbitmqctl help` and [rabbitmqctl man page](https://www.rabbitmq.com/man/rabbitmqctl.1.man.html) for details.
### `rabbitmq-plugins`
2019-04-01 18:54:04 +08:00
See `rabbitmq-plugins help` and [rabbitmq-plugins man page](https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html) for details.
### `rabbitmq-diagnostics`
2019-04-01 18:54:04 +08:00
See `rabbitmq-diagnostics help` and [rabbitmq-diagnostics man page](https://www.rabbitmq.com/rabbitmq-diagnostics.8.html).
## Testing
2016-02-04 00:13:02 +08:00
See [CONTRIBUTING.md](CONTRIBUTING.md).
2016-02-04 00:13:02 +08:00
2016-02-03 23:01:32 +08:00
## Developing
2016-11-15 06:00:50 +08:00
### Adding a New Command
2016-07-11 01:01:00 +08:00
#### Conventions
2016-07-11 01:01:00 +08:00
RabbitMQ CLI tools use module name conventions to match the command-line
actions (commands) to modules. The convention is outlined in the `CommandBehaviour` module.
2016-07-11 01:01:00 +08:00
#### Command Module Interface
Each command module must implement the `RabbitMQ.CLI.CommandBehaviour` behaviour,
which includes the following functions:
2016-11-15 06:05:45 +08:00
* `validate(args, opts)`, which returns either `:ok` or a tuple of `{:validation_failure, failure_detail}` where failure detail is typically one of: `:too_many_args`, `:not_enough_args` or `{:bad_argument, String.t}`.
2016-11-15 06:05:45 +08:00
* `merge_defaults(args, opts)`, which is used to return updated arguments and/or options.
2016-11-15 06:05:45 +08:00
* `run(args, opts)`, where the actual command is implemented. Here, `args` is a list of command-specific parameters and `opts` is a Map containing option flags.
2016-11-15 06:05:45 +08:00
* `usage`, which returns a string describing the command, its arguments and its optional flags.
* `banner(args, opts)`, which returns a string to be printed before the command output.
2017-04-08 17:07:03 +08:00
There are also a number of optional callbacks:
2016-12-13 22:59:50 +08:00
* `switches`, which returns command specific switches.
2017-04-08 17:07:03 +08:00
* `aliases`, which returns a list of command aliases (if any).
2016-11-15 06:05:45 +08:00
* `formatter`: what output formatter should be used by default.
* `usage_additional`: extra values appended to the `usage` output
to provide additional command-specific documentation.
* `scopes`: what scopes this command appears in. Scopes associate
tools (e.g. `rabbitmqctl`, `rabbitmq-diagnostics`, `rabbitmq-queues`, `rabbitmq-streams`) with commands.
* `distribution`: control erlang distribution.
Can be `:cli` (default), `:none` or `{:fun, fun}`
2016-11-30 23:26:15 +08:00
### Tutorial
2016-12-01 00:35:18 +08:00
We have [a tutorial](./COMMAND_TUTORIAL.md) that demonstrates how to add a CLI
2016-11-30 23:26:15 +08:00
command that deletes a queue.
2016-03-05 06:36:49 +08:00
2016-11-30 23:26:15 +08:00
### Examples
See `lib/rabbitmq/cli/ctl/commands/status_command.ex` and `test/status_command_test.exs` for minimalistic
but not entirely trivial examples.
2016-07-11 01:01:00 +08:00
## Copyright and License
2016-02-03 23:37:07 +08:00
The project is [licensed under the MPL](LICENSE-MPL-RabbitMQ), the same license
as RabbitMQ.
2016-07-11 01:01:00 +08:00
(c) 2007-2024 Broadcom. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.