Skip to content

Commit

Permalink
improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sfomuseumbot committed Sep 4, 2024
1 parent 2ba14f0 commit baa8b60
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ Go package to provide a common interface for abstract publish and subscribe oper

Documentation is incomplete at this time.

## Tools

```
$> make cli
go build -mod vendor -ldflags="-s -w" -o bin/publish cmd/publish/main.go
go build -mod vendor -ldflags="-s -w" -o bin/subscribe cmd/subscribe/main.go
```

## Examples

```
$> ./bin/publish \
-publisher-uri 'awssqs-creds://?region={REGION}&credentials={CREDENTIALS}&queue-url=https://sqs.{REGION}.amazonaws.com/{ACCOUNT}/{QUEUE}' \
'hello world'
```

```
$> ./bin/subscribe \
-subscriber-uri 'awssqs-creds://?region={REGION}&credentials={CREDENTIALS}&queue-url=https://sqs.{REGION}.amazonaws.com/{ACCOUNT}/{QUEUE}'
2024/09/04 10:59:57 INFO Listening for messages
hello world
```

## See also

* https://gocloud.dev/howto/pubsub/
Expand Down
4 changes: 2 additions & 2 deletions app/publish/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var mode string

func DefaultFlagSet() *flag.FlagSet {
fs := flagset.NewFlagSet("publish")
fs.StringVar(&publisher_uri, "publisher-uri", "", "...")
fs.StringVar(&mode, "mode", "", "...")
fs.StringVar(&publisher_uri, "publisher-uri", "", "A valid sfomuseum/go-pubsub/publisher.Publisher URI")
fs.StringVar(&mode, "mode", "", "Optional flag to signal whether data should be read for an alternate source. Valid options are: readline, stdin.")
return fs
}
4 changes: 2 additions & 2 deletions app/subscribe/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var publisher_uri string

func DefaultFlagSet() *flag.FlagSet {
fs := flagset.NewFlagSet("subscribe")
fs.StringVar(&subscriber_uri, "subscriber-uri", "", "...")
fs.StringVar(&publisher_uri, "publisher-uri", "stdout://?newline=true", "...")
fs.StringVar(&subscriber_uri, "subscriber-uri", "", "A valid sfomuseum/go-pubsub/subscriber.Subscriber URI")
fs.StringVar(&publisher_uri, "publisher-uri", "stdout://?newline=true", "A valid sfomuseum/go-pubsub/publisher.Publisher URI")
return fs
}
2 changes: 2 additions & 0 deletions publisher/gocloud.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package publisher

// ./bin/publish -publisher-uri 'awssqs-creds://?region={REGION}&credentials={CREDENTIALS}&queue-url=https://sqs.{REGION}.amazonaws.com/{ACCOUNT}/{QUEUE}' 'hello world'

import (
"context"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions subscriber/gocloud.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package subscriber

// https://gocloud.dev/howto/pubsub/subscribe/
// ./bin/subscribe -subscriber-uri 'awssqs-creds://?region={REGION}&credentials={CREDENTIALS}&queue-url=https://sqs.{REGION}.amazonaws.com/{ACCOUNT}/{QUEUE}'

import (
"context"
Expand Down

0 comments on commit baa8b60

Please sign in to comment.