Skip to content

Instantly share code, notes, and snippets.

View ripienaar's full-sized avatar

R.I.Pienaar ripienaar

View GitHub Profile
$ 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",
package main
import (
"strconv"
"sync"
"time"
"github.com/nats-io/jsm.go"
"github.com/nats-io/nats.go"
)
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
}
package main
import (
"context"
"fmt"
"github.com/nats-io/nats.go"
)
func main() {
nc, err := nats.Connect("localhost")
{
"name": "ORDERS",
"subjects": [
"ORDERS.*"
],
"retention": "limits",
"max_consumers": -1,
"max_msgs": -1,
"max_bytes": -1,
"max_age": 31536000000000000,
opts := stan.GetDefaultOptions()
if os.Getenv("NATS_URL")!="" {
opts = append(opts, stan.NatsURL(os.Getenv("NATS_URL"))
}
s, err := stan.Connect("mycluster", "myclient", opts...)
% 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
package main
import (
"context"
"fmt"
"hash/crc32"
"log"
"github.com/nats-io/nats.go"
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")
common:
manifest:
....
clusters:
- name: acme_servers
filter:
customer: acme
manifest:
package: