Preskoči na sadržaj

E15: Notifications & Communications

Overview

Bounded Context / Service: Notification Service

Goal: Deliver timely notifications via email and push to keep users informed.

Priority: High

Primary User Roles

  • All users (recipients)
  • Admin (for configuration)

Scope

In-Scope

  • Transactional emails (order confirmation, ticket delivery, quota invitation)
  • Push notifications via Firebase (queue updates, your turn, reminders)
  • Notification templates
  • Delivery tracking and status
  • High-volume push for queue scenarios (100k+)

Out-of-Scope

  • SMS notifications
  • In-app messaging/chat
  • Marketing email campaigns

Features

ID Feature Size Description
E15-F1 Transactional Email Service M Order and quota emails
E15-F2 Push Notification Service M Firebase push notifications

Dependencies

  • Email provider (Mailgun recommended)
  • Firebase Cloud Messaging

Technical Architecture

Notification Workers Extraction

Notifications are implemented as async workers separate from the main Symfony request/response cycle to handle high-volume scenarios and external API rate limits.

Why Extract as Workers

Requirement Challenge in Synchronous Flow Solution
100k+ push notifications during queue Blocks checkout flow Async worker processing
Email delivery latency 500ms+ per email API call Background job queue
External API rate limits Mailgun/Firebase throttling Controlled batch processing
Retry on failure Transaction rollback complexity Independent retry with backoff

Worker Architecture

Monolith (E4/E9/E7) ──Redis Queue──► Notification Workers ──► External APIs
        │                                   │
        │                                   ├──► Mailgun (Email)
        └── order.completed                 │
        └── ticket.generated                └──► Firebase (Push)
        └── quota.invitation

Worker Types

Worker Responsibility Scaling
Email Worker Process email jobs from Redis queue, call Mailgun API Single instance with rate limiting
Push Worker(s) Process push jobs, call Firebase API Horizontally scalable for queue peaks

Job Queue Events

Event Trigger Payload
order.completed Successful checkout (E4) Order ID, user email, ticket details
ticket.generated Ticket issuance (E9) Ticket ID, delivery email, QR timing
quota.invitation Quota creation (E7) Quota ID, recipient email, deep link
queue.position_update Position change (E5) User ID, position, match ID

Rate Limiting Strategy

  • Email: Max 100 emails/second (Mailgun limit)
  • Push: Batch up to 500 tokens per Firebase request
  • Queue notifications: Priority queue for "your turn" messages

See Microservices Strategy for detailed worker implementation.

Risks & Open Questions

Email Provider

Which email provider should be used (SendGrid, AWS SES, other)?

Push Rate Limits

What are the Firebase push notification rate limits and how should throttling be handled?


Last Updated: January 2026