AI Space

Backend & Runtime / Knowledge library

Apache Pulsar

persistent topics subscriptions and multi-tenant messaging

Distributed messaging and streaming platform

Why learn Apache Pulsar?

Useful for varied queue and streaming patterns. Subscription mode, ordering, and acknowledgment behavior should be matched to each consumer.

Where it came from

Apache Pulsar supports distributed messaging through persistent topics and configurable subscriptions. Its architecture separates serving messages from durable storage components.

Build your understanding

Work through these exercises in order. Try the task before opening a reference.

  1. Publish records to a test topic.
  2. Create consumers with a chosen subscription type.
  3. Observe acknowledgment and redelivery.
  4. Test message ordering within the intended scope.
  5. Document retention and replay requirements.

Documentation and sources

Catalog research notes

Connect the ideas

Alternatives

Apache Kafka (kafka)

Explore next

RabbitMQNATSEvent-Driven ArchitectureApache Kafka (kafka)Redpanda

Real World Example

Illustrative business scenario · AI-generated from linked documentation · Not a measured customer case study

Multi-Tenant Logistics Data Isolation

A global logistics platform providing supply chain tracking services to multiple independent shipping carriers.

The business problem

The platform struggles with data leakage and resource contention when multiple carriers share the same messaging infrastructure, leading to unauthorized access risks and noisy neighbor performance degradation.

How this topic solves it

Utilizing Apache Pulsar's multi-tenancy architecture, the platform assigns each carrier to a distinct tenant and namespace. Persistent topics ensure that message delivery is guaranteed via BookKeeper, while subscription types allow carriers to choose between exclusive processing for strict ordering or shared processing for parallel scaling.

  1. Create a dedicated tenant for each logistics carrier to enforce administrative isolation.
  2. Define namespaces within each tenant to manage topic policies and storage quotas.
  3. Configure persistent topics within the namespace to ensure messages are stored on disk via BookKeeper.
  4. Assign specific subscription types to consumer applications based on whether they require strict message ordering or high-throughput parallel processing.
Multi-Tenant Messaging Hierarchy · Entity relationships

This diagram illustrates the hierarchical relationship between tenants, namespaces, and topics.

Tenant

Carrier Organization

Namespace

Logical grouping of topics

Persistent Topic

Message storage unit

Subscription

Consumer access point

  • Tenant → owns (1:N) → Namespace
  • Namespace → contains (1:N) → Persistent Topic
  • Persistent Topic → has (1:N) → Subscription

Implementation example

This code demonstrates connecting to a persistent topic within a specific tenant and namespace, using a shared subscription to distribute load across multiple consumer instances.

java · Illustrative code; not executed or production-validated.

Consumer<byte[]> consumer = client.newConsumer()
    .topic("persistent://carrier-a/logistics-ns/tracking-updates")
    .subscriptionName("order-processor")
    .subscriptionType(SubscriptionType.Shared) // Allows parallel processing
    .subscribe();

Expected business outcome

Each carrier operates within a secure, isolated environment where their messaging traffic is logically separated from others, ensuring data privacy and predictable resource allocation.

Limitations and checks

Persistent topics incur storage overhead on BookKeeper nodes. To check if storage limits are reached, monitor the backlog size and storage usage metrics per namespace to prevent disk exhaustion.

Sources

Generated 2026-10-18 with gemini-3.1-flash-lite. Your assessment includes two questions about this example.

Catalog source: technology-maxxing. This page reproduces the existing catalog’s learning material and source links.