Quick Start
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.
Installation
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.
- Chocolatey
- Docker
- .NET tool (via NuGet)
- GitHub Releases
choco install busly-cli -y
To pull the busy-cli image and run it as a Docker container:
docker pull tragiccode/busly-cli
docker run --rm tragiccode/busly-cli --help
dotnet tool install --global dotnet-busly
dotnet-busly --help
Download the latest release Here
Configure a transport
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:15672
To confirm that your configuration file is valid and that busly-cli is using the local-rabbitmq transport by running:
busly transport current
This guide uses RabbitMQ for simplicity, but Busly supports multiple NServiceBus transports.
Check out the Transports section for other options.
Run RabbitMQ
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-management
Once 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.
Quickly Running an NServiceBus Endpoint (Demo Mode)
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.
Starting Demo Mode
Run the following command to start the demo endpoint
busly demo start
What Demo Mode Does
- 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
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.
Send a command
- Bash
- Powershell
- Docker (Bash)
- Docker (Powershell)
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.yaml
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"}'-replace '"', '\"') `
--config ./config.yaml
Publish an Event
- Bash
- Powershell
- Docker (Bash)
- Docker (Powershell)
busly 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.yaml
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"}'-replace '"', '\"') `
--config ./config.yaml