Building a Multi-Tenant Event Processing Pipeline: A Dive into Pub/Sub Architecture

Building a Multi-Tenant Event Processing Pipeline: A Dive into Pub/Sub Architecture

Building a Multi-Tenant Event Processing Pipeline: A Dive into Pub/Sub Architecture

Building a Multi-Tenant Event Processing Pipeline: A Dive into Pub/Sub Architecture

Multi-Tenant Pub/Sub Architecture

1. Topic Isolation Pattern

We’ve implemented a sophisticated topic isolation pattern that provides several key benefits:

  • Customer-Specific Topics: Each customer has dedicated publisher topics for events and user properties.

  • Independent Scaling: Topics can scale individually based on customer load.

  • Clear Data Boundaries: Naturally enforces data separation between customers.

  • Simplified Monitoring: Enables easy tracking of per-customer metrics.

  • Enhanced Security: Offers built-in data isolation at the infrastructure level.

2. Publishing Patterns

Our publishing approach ensures reliable and efficient event delivery:

  • Asynchronous Publishing: Enables non-blocking event publication.

  • Batch Processing: Efficiently handles bulk events before pushing them to topics. (Batch size is configurable per customer to allow modular scale)

  • Retry Mechanisms: Automatically retries failed publish attempts.

  • Dead Letter Queues: Captures failed topic pushes for debugging and disaster recovery.

  • Event retention: Retain events for 7 days for replay of messages in case of disaster recovery.


3. Subscriber Patterns

We’ve implemented a flexible subscription model that allows various downstream systems to process events according to their needs. This multi-layer subscription setup is core to our event pipeline.

  • Use Case-Based Subscriptions:

    1. Dedicated subscriber for data warehouse ingestion, optimized for batch processing and analytics.

    2. Real-time subscribers for time-sensitive tasks like agentic learning and eligibility decisions (core to Aampe’s agentic infrastructure).

  • Subscription Types: We use both Push and Pull subscriptions depending on the use case.

  • Monitoring and Control:

    1. Per-subscription metrics for throughput, latency, and error rates

    2. Dynamic scaling based on load

    3. Resource utilization tracking

    4. Cost management per subscription

  • Subscriber retention: Retain messages for 7 days to replay for disaster recovery


Key Architectural Decisions

1. Multi-Topic vs. Single Topic

We opted for a multi-topic architecture rather than a single topic with filtering, because it provides:

  • Better customer isolation

  • Easier monitoring and debugging

  • More granular scaling

  • Clearer cost attribution

  • Better compliance with data residency and governance

2. Synchronous vs. Asynchronous Processing

We rely on asynchronous processing to:

  • Improve response times for webhook endpoints

  • Absorb high-volume traffic spikes

  • Avoid timeout issues

  • Optimize resource utilization

  • Increase system resilience

Monitoring and Observability

  • Per-Customer Metrics: Track individual customer performance

  • Processing Latency: Measure end-to-end time from ingestion to processing

  • Error Rates: Monitor and alert on failures across the pipeline

  • Resource Utilization: Track CPU, memory, and other key metrics

  • Cost Metrics: Attribute processing costs down to the customer level

Security Considerations

Security is embedded at every layer of the architecture:

  • Data Isolation: Enforced through topic and subscription design

  • Authentication: Strong identity verification mechanisms

  • Authorization: Fine-grained access control using JWT-based claims

  • Audit Logging: Full activity logs for compliance and debugging

This architecture has proven to be highly scalable and reliable, processing millions of events each day while maintaining strict data isolation and delivery guarantees. Its separation of concerns, standardized event formats, and robust publishing mechanisms form the foundation of a resilient and future-ready event pipeline.

0

Related

Shaping the future of marketing with Aampe through innovation, data.

Aug 22, 2025

Team Aampe

With over 100M appointments booked by 8M+ users, theCut is expanding its use of Aampe’s agentic infrastructure to ensure every interaction — from finding the right barber to leaving a review — feels personal, relevant, and right on time. This renewed partnership sets a new standard for how service-driven marketplaces use AI to strengthen relationships at scale.

Aug 22, 2025

Team Aampe

With over 100M appointments booked by 8M+ users, theCut is expanding its use of Aampe’s agentic infrastructure to ensure every interaction — from finding the right barber to leaving a review — feels personal, relevant, and right on time. This renewed partnership sets a new standard for how service-driven marketplaces use AI to strengthen relationships at scale.

Aug 22, 2025

Team Aampe

With over 100M appointments booked by 8M+ users, theCut is expanding its use of Aampe’s agentic infrastructure to ensure every interaction — from finding the right barber to leaving a review — feels personal, relevant, and right on time. This renewed partnership sets a new standard for how service-driven marketplaces use AI to strengthen relationships at scale.

Aug 22, 2025

Team Aampe

With over 100M appointments booked by 8M+ users, theCut is expanding its use of Aampe’s agentic infrastructure to ensure every interaction — from finding the right barber to leaving a review — feels personal, relevant, and right on time. This renewed partnership sets a new standard for how service-driven marketplaces use AI to strengthen relationships at scale.

Schaun Wheeler, Aampe’s Chief Data Scientist and Co-Founder, joins Neural Rec to explain why personalization is a wicked learning problem and how agentic infrastructure adapts like humans do

Schaun Wheeler, Aampe’s Chief Data Scientist and Co-Founder, joins Neural Rec to explain why personalization is a wicked learning problem and how agentic infrastructure adapts like humans do

Schaun Wheeler, Aampe’s Chief Data Scientist and Co-Founder, joins Neural Rec to explain why personalization is a wicked learning problem and how agentic infrastructure adapts like humans do

Schaun Wheeler, Aampe’s Chief Data Scientist and Co-Founder, joins Neural Rec to explain why personalization is a wicked learning problem and how agentic infrastructure adapts like humans do

Jul 1, 2025

Team Aampe

In Year 2 of working together, MyPostcard is deepening its use of Aampe’s agentic infrastructure beyond CRM into the full product experience. By deploying agents that adapt to each user in real time, MyPostcard is turning static messaging into dynamic interactions — strengthening emotional connections at scale.

Jul 1, 2025

Team Aampe

In Year 2 of working together, MyPostcard is deepening its use of Aampe’s agentic infrastructure beyond CRM into the full product experience. By deploying agents that adapt to each user in real time, MyPostcard is turning static messaging into dynamic interactions — strengthening emotional connections at scale.

Jul 1, 2025

Team Aampe

In Year 2 of working together, MyPostcard is deepening its use of Aampe’s agentic infrastructure beyond CRM into the full product experience. By deploying agents that adapt to each user in real time, MyPostcard is turning static messaging into dynamic interactions — strengthening emotional connections at scale.

Jul 1, 2025

Team Aampe

In Year 2 of working together, MyPostcard is deepening its use of Aampe’s agentic infrastructure beyond CRM into the full product experience. By deploying agents that adapt to each user in real time, MyPostcard is turning static messaging into dynamic interactions — strengthening emotional connections at scale.

May 8, 2025

Team Aampe

Taxfix is teaming up with Aampe to bring continuously learning, agentic infrastructure to Europe’s leading digital tax platform. By adapting to each customer’s behavior in real time, the partnership makes tax filing more personal, less stressful, and a foundation for the future of financial services.

May 8, 2025

Team Aampe

Taxfix is teaming up with Aampe to bring continuously learning, agentic infrastructure to Europe’s leading digital tax platform. By adapting to each customer’s behavior in real time, the partnership makes tax filing more personal, less stressful, and a foundation for the future of financial services.

May 8, 2025

Team Aampe

Taxfix is teaming up with Aampe to bring continuously learning, agentic infrastructure to Europe’s leading digital tax platform. By adapting to each customer’s behavior in real time, the partnership makes tax filing more personal, less stressful, and a foundation for the future of financial services.

May 8, 2025

Team Aampe

Taxfix is teaming up with Aampe to bring continuously learning, agentic infrastructure to Europe’s leading digital tax platform. By adapting to each customer’s behavior in real time, the partnership makes tax filing more personal, less stressful, and a foundation for the future of financial services.

Load More

Load More

Load More

Load More