This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nats -s demo.nats.io req 'registry.detect_type' '{ | |
"schema": "io.nats.jetstream.advisory.v1.api_audit", | |
"id": "uafvZ1UEDIW5FZV6kvLgWA", | |
"timestamp": "2020-04-23T16:51:18.516363Z", | |
"server": "NDJWE4SOUJOJT2TY5Y2YQEOAHGAK5VIGXTGKWJSFHVCII4ITI3LBHBUV", | |
"client": { | |
"host": "::1", | |
"port": 57924, | |
"cid": 17, | |
"account": "$G", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"strconv" | |
"sync" | |
"time" | |
"github.com/nats-io/jsm.go" | |
"github.com/nats-io/nats.go" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func inFlightBuffer(_ *jsm.Stream, consumer *jsm.Consumer, tests int) error { | |
buffer := make(chan *nats.Msg, 1000) | |
ib := nats.NewInbox() | |
trigger := make(chan struct{}) | |
done := make(chan struct{}) | |
_, err := nc.ChanSubscribe(ib, buffer) | |
if err != nil { | |
return err | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/nats-io/nats.go" | |
) | |
func main() { | |
nc, err := nats.Connect("localhost") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ORDERS", | |
"subjects": [ | |
"ORDERS.*" | |
], | |
"retention": "limits", | |
"max_consumers": -1, | |
"max_msgs": -1, | |
"max_bytes": -1, | |
"max_age": 31536000000000000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opts := stan.GetDefaultOptions() | |
if os.Getenv("NATS_URL")!="" { | |
opts = append(opts, stan.NatsURL(os.Getenv("NATS_URL")) | |
} | |
s, err := stan.Connect("mycluster", "myclient", opts...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% terraform apply | |
An execution plan has been generated and is shown below. | |
Resource actions are indicated with the following symbols: | |
+ create | |
Terraform will perform the following actions: | |
# jetstream_stream.ORDERS will be created | |
+ resource "jetstream_stream" "ORDERS" { | |
+ ack = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"hash/crc32" | |
"log" | |
"github.com/nats-io/nats.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"github.com/aelsabbahy/goss/outputs" | |
"github.com/aelsabbahy/goss/util" | |
) | |
func TestUseAsPackage(t *testing.T) { | |
output := &bytes.Buffer{} | |
// temp spec file | |
fh, err := ioutil.TempFile("", "*.yaml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
common: | |
manifest: | |
.... | |
clusters: | |
- name: acme_servers | |
filter: | |
customer: acme | |
manifest: | |
package: |