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:
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:
import asyncio | |
import nats | |
from nats.errors import TimeoutError | |
async def main(): | |
nc = await nats.connect("localhost") | |
# Create JetStream context. |
import asyncio | |
import nats | |
from nats.errors import TimeoutError | |
async def main(): | |
nc = await nats.connect("localhost") | |
# Create JetStream context. |
import argparse | |
import asyncio | |
import sys | |
import time | |
from random import randint | |
import nats | |
try: | |
import uvloop |
nats: | |
image: nats:alpine | |
jetstream: | |
enabled: true | |
memStorage: | |
enabled: true | |
size: "2Gi" |
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: |
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/nats-io/nats.go" | |
) | |
func main() { |