Перейти к основному содержимому

NATS JetStream

NATS JetStream is the message queue used for inter-service event delivery in the Crawbl platform. Usage events no longer flow through NATS — they are enqueued as River jobs directly inside the orchestrator and written to ClickHouse in-process.


Connection Details

PropertyValue
Service namebackend-nats
Namespacebackend
Port4222 (NATS client)
ChartBitnami NATS v1.2.9
ArgoCD sync wave5 (data layer)
Replicas1 (dev)
JetStream storageFile-based, 2Gi PVC

Getting credentials

kubectl get secret backend-nats-auth -n backend \
-o jsonpath='{.data}' | jq -r 'to_entries[] | "\(.key): \(.value | @base64d)"'

Role in the Platform

NATS is used for event delivery between platform components. The usage analytics pipeline no longer goes through NATS — usage events are now enqueued as River jobs inside the orchestrator and written directly to ClickHouse:

Agent Runtime → gRPC UsageEvent → Orchestrator → River (usage_write queue) → ClickHouse

Connecting to NATS

Port-forward

kubectl port-forward svc/backend-nats 4222:4222 -n backend

Check stream status (using nats CLI)

nats stream info CRAWBL_USAGE --server=nats://localhost:4222

View pending messages

nats stream view CRAWBL_USAGE --server=nats://localhost:4222 --last=5

Debugging

Check NATS pod

kubectl get pods -n backend -l app.kubernetes.io/name=nats

View NATS logs

kubectl logs -n backend -l app.kubernetes.io/name=nats --tail=50

Common issues

SymptomLikely CauseFix
Storage fullJetStream exceeded 2GiCheck stream info; increase PVC or reduce retention
Connection refusedSecret mismatchVerify backend-nats-auth secret

What's next: See Billing & Usage for the full pipeline, or ClickHouse for the analytics database.