Skip to main content

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.

choco install busly-cli -y

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.

~/.busly-cli/config.yaml
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
note

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.DemoEndpoint using 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.

Send a command

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"}'

Publish an Event

busly event publish \
--content-type 'text/json' \
--enclosed-message-type "Messages.Events.OrderPlaced" \
--message-body '{"OrderNumber":"3f2d6c8a-b7a2-4c3f-9c3e-12ab45ef6789"}'