Skip to content

A linux-style command line app for interacting with Azure Service Bus written in .NET Core.

Notifications You must be signed in to change notification settings

seanrmilligan/QueueView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

QueueView

Overview

QueueView is a linux-style command line app for interacting with Azure Service Bus written in .NET Core.

Getting Started

QueueView uses a connection string to interact with Azure Service Bus. It does so by maintaining a list of 'connections' in a config file in the user's home folder.

Add a connection

To save a new connection, provide a friendly name and the connection string using the connections verb:

sean@computer $ qv connections -n servicebus-prod -c "Endpoint=sb://NAMESPACE.servicebus.windows.net/;SharedAccessKeyName=KEYNAME;SharedAccessKey=KEY"

View saved connections

To see the newly added connection, use the connections verb without any arguments.

sean@computer $ qv connections
servicebus-prod Endpoint=sb://NAMESPACE.servicebus.windows.net/;SharedAccessKeyName=KEYNAME;SharedAccessKey=KEY
sean@computer $

Read messages from a queue

Now that there is a saved connection, it is possible to read messages. QueueView handles Azure Service Bus queues and subscriptions. Queues use a producer-consumer model, while subscriptions use a publisher-subscriber model.

To read from a queue, use the 'messages' verb. Reading from a queue requires two bits of information: the name of a saved connection and the name of the queue.

sean@computer $ qv messages --connection servicebus-prod --queue status-updates
MessageId, SeqNum, Body, User Properties
au6d34, 123, {"title": "I got a dog!", "content": "His name is Buddy, and he's the cutest. :)"}, {}
sean@computer $

By default, the messages print in a pseudo-CSV format. The messages are printed one message per line, and additional metadata is provided such as the sequence number of the message. You can specify which fields you would like to see using the --fields argument.

sean@computer $ qv messages --connection servicebus-prod --queue status-updates --fields Body
{"title": "I got a dog!", "content": "His name is Buddy, and he's the cutest. :)"}
sean@computer $

Chaining with other tools

This lends itself to easier parsing and formatting via chaining with other command line utilities such as grep or jq.

sean@computer $ qv messages --connection servicebus-prod --queue status-updates --fields Body | jq '.'
{
  "title": "I got a dog!",
  "content": "His name is Buddy, and he's the cutest. :)"
}
sean@computer $

Permissions

QueueView can only do as much as the permissions of the connection string allow. If the connection string is an administrator-level connection string, you will be able to see metadata about queues and write to queues or topics. If the connection string only provides read-only permissions, then it will only be possible to peek or dequeue messages.

Connections

  • Get or set the default connection. Use . to get. qv connections -d <connection-name>
  • List the connections qv connections
  • Add a connection qv connections -s <connection-string> -n <connection-name>
  • Update a connection qv connections -s <connection-string> -n <connection-name> -u
  • Delete a connection qv connections -D <connection-name>

Queues

  • List the queues in the default connection qv queues
  • List the queues in the specified connection qv queues -c <connection-name>

Topics

  • List the topics in the default connection qv topics
  • List the topics in the specified connection qv topics -c <connection-name>

Subscriptions

  • List the subscriptions in all topics in the default connection qv subscriptions
  • List the subscriptions in the specified topic using the default connection qv subscriptions -t <topic-name>
  • List the subscriptions in the specified topic using the specified connection qv subscriptions -c <connection-name> -t <topic-name>

Messages

  • List the messages in the specified queue qv messages -q <queue-name>
  • List the messages in the specified subscription qv messages -s <subscription-name>
  • List the messages in the specified topic and subscription qv messages -t <topic-name> -s <subscription-name>
  • List the deadletter messages in the specified queue or subscription qv messages [...] -d
  • List a specified number of messages in the specified queue or subscription qv messages [...] -n <count>
  • List the messages in a table format qv messages [...] -p
  • List only the specified fields for messages qv messages [...] -f field1,field2

Send

  • Send messages to a queue qv send [...] -C <destination-connection> -Q <destination-queue>
  • Send messages to a topic qv send [...] -C <destination-connection> -T <destination-topic>
  • Send messages from a file (one message per line) qv send [...] -f <file-name>
  • Send messages from standard input (one message per line) echo 'message' | qv send [...] -i
  • Send messages read from a Service Bus queue qv send -c <source-connection> -q <source-queue> [...]
  • Send messages read from a Service Bus subscription qv send -c <source-connection> -t <source-topic> -s <source-subscription> [...]
  • Consume messages as you read them from Service Bus qv send [...] -D
  • Send messages read from a dead letter queue in Service Bus qv send [...] -d

Status

  • Show metadata about the specified queue in the default connection qv status -q <queue-name>
  • Show metadata about the specified queue in the specified connection qv status -c <connection-name> -q <queue-name>
  • Show metadata about the specified subscription in the specified topic and specified connection qv status -c <connection-name> -t <topic-name> -s <subscription-name>

About

A linux-style command line app for interacting with Azure Service Bus written in .NET Core.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages