Create Apache Pulsar producers and consumers with all subscription types

domain: data-engineering · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a Pulsar client with PulsarClient.builder().serviceUrl('pulsar://...').build().
  2. Create a producer: client.newProducer().topic('persistent://tenant/namespace/topic').create(); send messages with producer.send(payload).
  3. Create a consumer: client.newConsumer().topic('...').subscriptionName('my-sub').subscriptionType(SubscriptionType.Shared).subscribe(). Choose the subscription type: Exclusive (single active consumer), Shared (round-robin across consumers, no ordering), Failover (one active, others on standby with ordering), Key_Shared (messages with the same key always go to the same consumer).
  4. Call consumer.receive() in a loop, process the message, then call consumer.acknowledge(msg) on success.
  5. Close producer and consumer when done to release resources.

Known gotchas

Related routes

Configure Apache Pulsar topics, subscriptions, and subscription types
pulsar.apache.org · 5 steps · unrated
Configure Apache Pulsar Key_Shared subscription for ordered per-key fan-out
pulsar · 6 steps · unrated
Set up Apache Pulsar Functions to perform stateless stream processing and deploy via pulsar-admin
pulsar.apache.org · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans