Skip to content

Commit

Permalink
Release 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
j.neubauer committed Sep 7, 2022
1 parent 7514487 commit 32614c8
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 148 deletions.
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
## Description
This is a commandline utility to send and receive messages to Azure servicebus queues.
Supports connection only via connection string.
Simple commandline utility to send and receive messages to/from
[Azure servicebus](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview)
queues.

Limitations:
- Only queues are supported.
- Authentication is supported only with connection string.

## Download
Download a Linux/Windows binary here: https://github.com/jakubneubauer/azure-sb-cli/releases

## Usage

## Example

### Using a queue without sessions support
```shell

# Connection string and session-less queue name - variables used in the
# rest of the example
$ CONN_STR="*** YOUR CONNECTION STRING ***"
$ QUEUE_NAME = "your queue name"

# Send a message
$ echo "Hello world!" | ./azure-sb-cli send -c "$CONN_STR" -q "$QUEUE_NAME"

# Receive message
$ azure-sb-cli receive -c "$CONN_STR" -q $QUEUE_NAME
Hello world!
```

### Communicating with queue using sessions
```shell

# Connection string and session-less queue name - variables used in the
# rest of the example
$ CONN_STR="*** YOUR CONNECTION STRING ***"
$ QUEUE_NAME = "your queue name"

# Send a message
$ echo "Hello world!" | ./azure-sb-cli send -c "$CONN_STR" -q "$QUEUE_NAME" -s "session-12345"

# Receive message:
# - using empty string as a session ID will receive message from any session.
# - The message is prefixed with session ID in the output
$ azure-sb-cli receive -c "$CONN_STR" -q $QUEUE_NAME -p -s ""
session-12345:Hello world!
```

## Documentation
```
./azure-sb-cli -h
Usage: ./azure-sb-cli <command> <options>
Expand All @@ -32,3 +74,9 @@ Receive options:
Send option:
-i Correlation ID for sent messages
```

# Further development
Ideas to implement:
- Support Correlation ID for `receive` operation.
- Support for servicebus topics.
- Batch send/receive for better performance.
8 changes: 6 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash

VERSION="0.4-preview"
VERSION="0.4"
DATE=`date -u '+%Y-%m-%d_%H:%M:%S'`

build() {
go build -o azure-sb-cli$EXT -ldflags "-X main.buildVersion=$VERSION -X main.buildDate=$DATE" main.go
}
build

# I use linux => this is the Linux build ;-)
GOOS=linux GOARCH=amd64 EXT="" build

# Windows binary build
GOOS=windows GOARCH=386 EXT=.exe build
12 changes: 12 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/jakubneubauer/azure-sb-cli

go 1.18

require github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.1.0

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/text v0.3.7 // indirect
)
25 changes: 25 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w=
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.1.0 h1:ebO2jmZyctLSMBTvjsxZv/Ml3rGsvnJHUImVWotBl7I=
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.1.0/go.mod h1:LH9XQnMr2ZYxQdVdCrzLO9mxeDyrDFa6wbSI3x5zCZk=
github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
Loading

0 comments on commit 32614c8

Please sign in to comment.