/data-messaging-skills:nats-and-pulsar-lightweight-messaging-configurationfrom data-messaging-skills
Configures NATS pub/sub, JetStream persistence, and Apache Pulsar topics/subscriptions as lighter-weight alternatives to Kafka/RabbitMQ. Also provides a decision framework for choosing between them.
Ships in data-messaging-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Kafka and RabbitMQ are the default reach for most teams, but both carry real operational weight — Kafka's broker/ZooKeeper-or-KRaft cluster and partition-management model, RabbitMQ's exchange/vhost/clustering concepts — that isn't justified for every workload. NATS (core pub/sub, or JetStream for persistence) and Apache Pulsar are lighter-weight options that trade some of Kafka's ecosystem maturity and RabbitMQ's routing flexibility for a simpler operational model or, in Pulsar's case, independent scaling of compute (brokers) from storage (BookKeeper). This skill covers configuring both deliberately and — just as importantly — deciding when they're the right choice instead of reaching for Kafka or RabbitMQ by default. Topology/cluster design for the two mainstream options is covered separately in kafka-cluster-configuration and rabbitmq-configuration.
nats-server (single node for core pub/sub
experimentation; at least 3 nodes in a clustered/JetStream deployment
for meaningful HA, since JetStream replication also relies on Raft
consensus similar to Kafka's controller quorum or RabbitMQ's quorum
queues) and the nats CLI for stream/consumer administration.pulsar-admin CLI or REST admin API for tenant/namespace/topic
administration. Pulsar's broker/storage split means broker and
BookKeeper node counts are sized independently — don't assume a 1:1
node relationship the way Kafka's broker-holds-its-own-log model
implies.Decide core NATS vs. JetStream vs. Pulsar vs. Kafka/RabbitMQ using the actual requirement, not familiarity or hype. A rough decision framework:
nats-server binary, no separate coordination service beyond the
cluster's own Raft group) and doesn't need Kafka's partition-level
ordering/throughput ceiling or its broad connector/stream-processing
ecosystem.Configure core NATS pub/sub for the fire-and-forget case:
# publish
nats pub orders.created '{"order_id": "o-123", "status": "created"}'
# subscribe
nats sub "orders.>"
orders.> is a wildcard subject subscription (NATS subjects are
dot-separated hierarchies, roughly analogous to RabbitMQ topic-exchange
routing keys) — > matches one or more trailing tokens, * matches
exactly one token. There is no broker-side persistence here: a
subscriber that isn't connected when a message publishes never sees
it.
Enable JetStream and create a stream when persistence/replay is needed:
nats stream add ORDERS \
--subjects "orders.>" \
--storage file \
--retention limits \
--max-msgs=-1 \
--max-age=168h \
--replicas=3
--storage file persists to disk (vs. memory, which doesn't survive
a server restart); --replicas=3 requires a 3+ node JetStream cluster
and gives Raft-based replication comparable in spirit to Kafka's
replication factor or RabbitMQ's quorum queues — a --replicas=1
stream has no redundancy and is a single point of failure the same way
an unreplicated Kafka partition or a classic RabbitMQ queue with no
mirrors would be.
Create a durable consumer with explicit ack policy and redelivery bounds, mirroring the poison-message safeguard covered for RabbitMQ in rabbitmq-queue-and-dead-letter-troubleshooting:
nats consumer add ORDERS fulfillment-worker \
--filter "orders.created" \
--ack explicit \
--max-deliver 5 \
--deliver last \
--wait 30s
--max-deliver 5 caps redelivery attempts before JetStream stops
redelivering that message to this consumer, the JetStream equivalent
of RabbitMQ's x-delivery-limit — without a bound, a message the
consumer can never successfully process would otherwise redeliver
indefinitely.
For Pulsar, create a tenant/namespace/topic hierarchy deliberately, using the multi-tenancy model as an isolation boundary the way vhosts isolate RabbitMQ applications:
pulsar-admin tenants create orders-org
pulsar-admin namespaces create orders-org/fulfillment
pulsar-admin namespaces set-retention orders-org/fulfillment \
--size 10G --time 7d
pulsar-admin topics create-partitioned-topic \
persistent://orders-org/fulfillment/order-events --partitions 6
A persistent:// topic writes to BookKeeper for durability; a
non-persistent:// topic behaves closer to core NATS's fire-and-forget
model (in-memory only, no durability) — choose deliberately per topic
rather than defaulting to whichever the client library's example
snippet happened to use.
Choose a Pulsar subscription type based on the actual fan-out/ ordering need:
# Exclusive: one consumer only, strict order
# Shared: round-robin across consumers, no per-key ordering guarantee
# Key_Shared: like Shared, but same-key messages always go to the same consumer
# Failover: one active consumer, others on standby for automatic failover
Key_Shared is the closest Pulsar analogue to Kafka's partition-key
ordering guarantee combined with multi-consumer parallelism — use it
when messages for the same entity (e.g. order_id) must be processed
in order but overall throughput needs more than one consumer.
Set explicit retention and TTL/backlog quotas on any persistent stream/topic, the same durability-vs-unbounded-growth tradeoff covered for RabbitMQ in rabbitmq-configuration-validation:
pulsar-admin namespaces set-backlog-quota orders-org/fulfillment \
--limit 10G --policy producer_exception
producer_exception blocks further publishes once the quota is hit
(loud failure) rather than silently discarding the oldest messages —
choose the overflow policy deliberately based on whether silent data
loss or blocked publishing is the safer failure mode for the workload.
--replicas 3
(or Pulsar's equivalent ensemble/write-quorum/ack-quorum settings) for
anything where losing the whole stream/topic on a single node failure
is unacceptable — a single-replica stream is a single point of failure
regardless of how it's labeled.--max-deliver/redelivery bound on every durable
JetStream consumer and a dead-letter-topic policy on Pulsar
subscriptions, mirroring the poison-message protection covered in
rabbitmq-queue-and-dead-letter-troubleshooting —
don't assume lighter-weight brokers are exempt from the poison-message
problem.Symptom: A service migrated from core NATS pub/sub to JetStream
assuming it would "just work," but consumers report duplicate message
processing.
Fix: JetStream's --ack explicit delivery is at-least-once by
design — a message is redelivered if not acked within the consumer's
ack-wait window, including cases where the consumer did process it but
the ack was lost/delayed. Consumer logic must be idempotent (safe to
process the same message twice), the same requirement that applies to
any at-least-once system (Kafka, RabbitMQ, JetStream, Pulsar) — this
isn't specific to JetStream, but teams moving from fire-and-forget core
NATS often haven't built for it yet.
Symptom: A JetStream stream or Pulsar topic created with a single
replica/no redundancy loses all its messages when the one node hosting
it fails.
Fix: This is the direct consequence of skipping replication — check
--replicas (JetStream) or the namespace's ensemble/ack-quorum settings
(Pulsar) before treating any stream/topic as production-durable. A
single-node stream is equivalent in risk to an unreplicated Kafka
partition or a non-mirrored classic RabbitMQ queue.
Symptom: A team picks Pulsar for a new service expecting Kafka-like throughput and a mature Kafka Connect-style ecosystem, but hits friction because a needed connector or client library either doesn't exist or is far less mature than its Kafka equivalent. Fix: Verify the specific connector/client/tooling ecosystem maturity for the target language and use case before committing, rather than assuming Pulsar's core feature set (partitioning, durability, multi-tenancy) implies ecosystem parity with Kafka — if the team's actual need is that ecosystem, Kafka (kafka-cluster-configuration) may still be the better fit despite Pulsar's architectural advantages.
Symptom: A NATS JetStream consumer with no --max-deliver set
redelivers a message indefinitely because the consumer's handler always
throws on that specific payload.
Fix: This is the same poison-message pattern covered for RabbitMQ in
rabbitmq-queue-and-dead-letter-troubleshooting —
set an explicit --max-deliver bound and configure a dead-letter
subject/stream (via --max-deliver combined with a subject the consumer
publishes failed messages to) so a bad message surfaces for
investigation instead of looping forever and starving other messages
behind it in ordered delivery.
Scenario: A new internal "shipment status" service needs to notify several downstream services whenever a shipment's status changes. The team's first instinct is "we already run Kafka, just add a topic," but the actual requirements are: fewer than 50 messages/second, downstream services only care about the current status (not a full history/replay requirement beyond a short window), and the team wants to avoid adding another Kafka topic (with its consumer-group/partition-count decisions) for something this small.
Decision: this is a good fit for NATS JetStream rather than Kafka — the
throughput is trivial for either system, but JetStream's operational
footprint (a single nats-server binary, no separate schema registry or
partition-rebalancing concerns) is a better match than adding to an
already-large Kafka deployment for a low-volume, short-retention use case.
Core NATS (no persistence) is rejected because downstream services do
need at-least-once delivery — a dropped status update would show a stale
shipment status to customers.
Stream and consumer setup:
nats stream add SHIPMENT_STATUS \
--subjects "shipments.status.>" \
--storage file \
--retention limits \
--max-age=24h \
--replicas=3
nats consumer add SHIPMENT_STATUS notifications-worker \
--filter "shipments.status.updated" \
--ack explicit \
--max-deliver 5 \
--deliver last \
--wait 30s
--max-age=24h matches the requirement that only recent history matters
— unlike Kafka, where retention is usually set far longer for replay/
reprocessing use cases, this stream deliberately keeps a short window
since nothing downstream needs to replay shipment status from a week ago.
--replicas=3 still ensures the stream survives a single-node failure
despite the low message volume, since durability matters even though
throughput doesn't.
Publisher:
nc = await nats.connect("nats://nats-cluster:4222")
js = nc.jetstream()
await js.publish("shipments.status.updated", shipment_status_payload)
Consumer acks explicitly after successfully processing, and a message
that fails 5 times (e.g. a malformed payload from a buggy upstream
release) stops redelivering to this consumer and is flagged via the
consumer's num_pending/num_redelivered metrics for investigation,
rather than looping indefinitely.
--max-deliver and Pulsar's dead-letter policy.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
nats, pulsar, jetstream, message-broker, pub-sub, event-streaming
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin data-messaging-skills13 skills in this plugin
/airflow-dag-authoring-and-validationAuthors Apache Airflow DAGs — task dependencies, operator choice, sensors, idempotency — and validates them with `airflow dags test`, import-time checks, and DAG linting before they reach a production scheduler. Use when the user asks to "write an Airflow DAG," "add a task dependency," "use a sensor to wait for a file/table," "validate a DAG before deploying it," "lint an Airflow DAG," or reviews a DAG file for correctness before merge.
/airflow-scheduler-and-dag-troubleshootingDiagnoses a stuck or failed Airflow DAG run, scheduler-health problems (slow parsing, stuck queued tasks), and plans safe task-retry/backfill strategy. Use when the user reports "Airflow DAG is stuck," "task stuck in queued state," "scheduler seems unhealthy," "DAG run failed and I need to retry it," "should I backfill this DAG," or asks to troubleshoot a live Airflow production incident.
/dagster-and-prefect-pipeline-authoringAuthors data pipelines with Dagster's asset-based model or Prefect's Pythonic flow/task model as modern alternatives to Airflow, and gives a decision framework for when each fits better than task-based DAG orchestration. Use when the user asks to "write a Dagster asset," "define a Prefect flow," "should we use Dagster instead of Airflow," "asset-based vs. task-based orchestration," or is evaluating a data-orchestration tool for a new pipeline.
Other plugins' skills for the same job