This Go package provides a simple command-line interface (CLI) tool for interacting with Azure Service Bus Queue. It allows you to send/receive messages from/to a queue.
- Go, version 1.18 or higher - Install Go
- Azure subscription - Create a free account
- Service Bus namespace - Create a namespace
- Service Bus queue - Create a queue
If you want to try out the tool, you'll need to:
- Deploy Azure Service Bus and create a queue.
- Install the tool.
Easiest way how-to do that is to use the Azure CLI and execute script.sh file:
wget https://raw.githubusercontent.com/groovy-sky/service-bus-queue-cli/main/script.sh
chmod +x script.sh
./script.sh
Once you have created a queue, you can use the tool to send/receive messages from/to the queue. At first you'll need to set the AZURE_SERVICEBUS_CONNECTION_STRING environment variable to your Azure Service Bus connection string. Here's how you can do it:
export AZURE_SERVICEBUS_CONNECTION_STRING="your-connection-string"
After that you can use the tool to send/receive messages from/to a queue.
To send a message(subject and reply-to are optional):
azbusqueue send --queue your-queue-name --message "Your message" --subject "Your subject" --replyto "Your reply-to"
To receive a message from a queue:
azbusqueue read --queue your-queue-name