Skip to content

Instantly share code, notes, and snippets.

View wallyqs's full-sized avatar
🌎

Waldemar Quevedo wallyqs

🌎
  • Synadia Communications, Inc.
  • San Francisco
  • X @wallyqs
View GitHub Profile
@wallyqs
wallyqs / readme.md
Created July 15, 2023 04:10
JetStream on Docker with Docker Compose

First, create a few volumes so that state is persisted across restarts:

docker volume create nats1
docker volume create nats2
docker volume create nats3

Now create a docker-compose.yaml with the following:

@wallyqs
wallyqs / stan.md
Last active July 28, 2022 17:45
Updating stan.go dependencies

Approach 1

Steps

$ rm go.sum 
$ rm go.mod

$ go run examples/stan-pub/main.go 
examples/stan-pub/main.go:24:2: no required module provides package github.com/nats-io/nats.go: go.mod file not found in current directory or any parent directory; see 'go help modules'
import asyncio
import nats
from nats.errors import TimeoutError
async def main():
nc = await nats.connect("localhost")
# Create JetStream context.
@wallyqs
wallyqs / pub-ack-duplicate.py
Created June 1, 2022 17:58
Pub JS Msg ID example
import asyncio
import nats
from nats.errors import TimeoutError
async def main():
nc = await nats.connect("localhost")
# Create JetStream context.
@wallyqs
wallyqs / js-pub-bench.py
Created May 24, 2022 20:01
js pub bench
import argparse
import asyncio
import sys
import time
from random import randint
import nats
try:
import uvloop
@wallyqs
wallyqs / nats-auth.yaml
Created March 18, 2022 16:16
Example System Account in Helm
nats:
image: nats:alpine
jetstream:
enabled: true
memStorage:
enabled: true
size: "2Gi"
@wallyqs
wallyqs / client-v2-js.rb
Last active October 27, 2021 22:42
NATS::Client and NATS::JetStream (nats-pure.rb v2.0.0)
require 'nats'
# Connect to server that has JetStream support, e.g.
#
# nats-server -js
#
# To include in Gemfile:
#
# source "https://rubygems.org"
#
nats:
image: nats:2.4.0-alpine
limits:
maxConnections:
maxSubscriptions:
maxControlLine:
maxPayload:
writeDeadline:
maxPending:
@wallyqs
wallyqs / readme.md
Created July 22, 2021 15:03
Mixed Auth via Leafnodes

Mixed Auth via Leafnodes

Server A starts with basic auth:

port = 4222

leaf {
  port = 7422
}
@wallyqs
wallyqs / pull-subscribe-filter-subject.go
Created May 19, 2021 19:36
Subscribing with Filter Subject and JS context
package main
import (
"fmt"
"log"
"github.com/nats-io/nats.go"
)
func main() {