import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem"; import CodeBlock from "@theme/CodeBlock";
This guide walks you through how you can install Busly CLI, which was built from the ground up for cross-platform compatibility and offers a variety of installation options to suit different environments and use cases.
Busly CLI was built from the ground up for cross-platform compatibility and offers a variety of installation options to suit different environments and use cases.
choco install busly-cli -ywinget install TragicCode.BuslyCLITo pull the busy-cli image and run it as a Docker container:
docker pull tragiccode/busly-cli
docker run --rm tragiccode/busly-cli --helpdotnet tool install --global dotnet-busly
dotnet-busly --helpDownload the latest release Here
Next, lets configure a rabbitmq transport called local-rabbitmq that will tell the cli how to send messages to RabbitMQ running in a docker container on our local computer.
current-transport: local-rabbitmq
transports:
- name: local-rabbitmq
rabbitmq-transport-config:
amqp-connection-string: amqp://localhost
management-api:
url: http://localhost:15672To confirm that your configuration file is valid and that busly-cli is using the local-rabbitmq transport by running:
busly transport current:::note This guide uses RabbitMQ for simplicity, but Busly supports multiple NServiceBus transports.
Check out the Transports section for other options. :::
The quickest way to get RabbitMQ running on your machine is using Docker. Run the following command:
docker run -d \
--name rabbitmq \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:4-managementOnce the container is running, open the RabbitMQ Management UI in your browser at http://localhost:15672 and log in with the default credentials, username: guest and password: guest, to verify that RabbitMQ is running correctly.
Before sending messages with Busly, you need an active endpoint connected to your configured transport.
To make this easy, Busly provides a demo mode, which automatically creates and runs an NServiceBus endpoint using your current transport configuration.
Run the following command to start the demo endpoint
busly demo start- Creates and starts an NServiceBus endpoint named
BuslyCLI.DemoEndpointusing your transport configuration. - Allows Busly to receive any command sent to it.
- Automatically subscribes to a single event:
Messages.Events.OrderPlaced
:::warning
Demo mode is intended strictly for this quick-start guide. Using it outside of this context is highly discouraged, as it will attempt to create queues and exchanges in whatever transport is currently configured. If your current transport happens to be pointed production or shared environments this will not be ideal.
:::
busly command send \
--content-type 'text/json' \
--enclosed-message-type "Messages.Commands.CreateOrder" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'busly command send `
--content-type 'text/json' `
--enclosed-message-type "Messages.Commands.CreateOrder" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"')docker run --rm \
--network host \
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" \
tragiccode/busly-cli \
command send \
--content-type "text/json" \
--enclosed-message-type "Messages.Commands.CreateOrder" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}' \
--config ./config.yamldocker run --rm `
--network host `
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" `
tragiccode/busly-cli `
command send `
--content-type "text/json" `
--enclosed-message-type "Messages.Commands.CreateOrder" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"') `
--config ./config.yamlbusly event publish \
--content-type 'text/json' \
--enclosed-message-type "Messages.Events.OrderPlaced" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'busly event publish `
--content-type 'text/json' `
--enclosed-message-type "Messages.Events.OrderPlaced" `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"')docker run --rm \
--network host \
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" \
tragiccode/busly-cli \
event publish \
--content-type "text/json" \
--enclosed-message-type "Messages.Events.OrderPlaced" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}' \
--config ./config.yamldocker run --rm `
--network host `
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" `
tragiccode/busly-cli `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"') `
--config ./config.yamlbusly timeout send \
--content-type 'text/json' \
--enclosed-message-type "Messages.Timeouts.OrderTimeout" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}' \
--delay-delivery-with "00:00:05"busly timeout send `
--content-type 'text/json' `
--enclosed-message-type "Messages.Timeouts.OrderTimeout" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"') `
--delay-delivery-with "00:00:05"docker run --rm \
--network host \
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" \
tragiccode/busly-cli \
timeout send \
--content-type "text/json" \
--enclosed-message-type "Messages.Timeouts.OrderTimeout" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}' \
--delay-delivery-with "00:00:05" \
--config ./config.yamldocker run --rm `
--network host `
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" `
tragiccode/busly-cli `
timeout send `
--content-type "text/json" `
--enclosed-message-type "Messages.Timeouts.OrderTimeout" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body ('{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'-replace '"', '\"') `
--delay-delivery-with "00:00:05" `
--config ./config.yamlAs you can see in the commands above, inlining JSON directly in the terminal can get complicated fast — especially in PowerShell, where double quotes require manual escaping. For anything beyond the simplest payloads, this becomes error-prone and hard to read.
Busly supports a curl-style @filename syntax for --message-body, letting you store your JSON in a file and reference it directly. Where payload.json contains:
{
"OrderNumber": "3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"
}busly command send \
--content-type 'text/json' \
--enclosed-message-type "Messages.Commands.CreateOrder" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body @payload.jsonbusly command send `
--content-type 'text/json' `
--enclosed-message-type "Messages.Commands.CreateOrder" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body "@payload.json"
When running via Docker, mount the payload file into the container using `-v` and reference its container path with `@`:
```bash
docker run --rm \
--network host \
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" \
-v "$(pwd)/payload.json:/app/payload.json" \
tragiccode/busly-cli \
command send \
--content-type "text/json" \
--enclosed-message-type "Messages.Commands.CreateOrder" \
--destination-endpoint "BuslyCLI.DemoEndpoint" \
--message-body @/app/payload.json \
--config ./config.yamlWhen running via Docker, mount the payload file into the container using -v and reference its container path with @:
docker run --rm `
--network host `
-v "$HOME/.busly-cli/config.yaml:/app/config.yaml" `
-v "${PWD}/payload.json:/app/payload.json" `
tragiccode/busly-cli `
command send `
--content-type "text/json" `
--enclosed-message-type "Messages.Commands.CreateOrder" `
--destination-endpoint "BuslyCLI.DemoEndpoint" `
--message-body "@/app/payload.json" `
--config ./config.yamlNo escaping required on any platform. Relative paths are resolved from your current working directory, and ~ is expanded to your home directory.