How shahnewaz-labib/notification-service-exp works
API Layer
• Separate endpoints for SMS and Email services
• Request validation middleware
• Use REST API symbol or hexagon for the API gateway
Controller Layer
• EmailController and smsController as separate components
• Their connection to routes and services
Service Layer
• EmailService and SMSService as core business logic components
• Connection to providers and utility services
Provider Layer
• Email Providers (A, B, C)
• SMS Providers (A, B, C)
• Provider failover relationships
Task Management System
• TaskQueue component
• DeadLetterQueue for failed messages
• Retry flow
Utility Components
• Circuit Breaker
• Retry Strategies
• Request Validation
• [Client Requests]
• ↓
• [API Layer (Routes)]
• ↓
• [Controllers]
• ↓
• [Services]
• ↓
• [Providers]
Specific Flows
• Normal message flow
• Provider failover path
• Retry mechanism
• Dead letter queue process
Specific Implementation Details:
Main Request Flow
• Client → Routes → Controller → Service → Provider
Error Handling Flow
• Provider Failure → Circuit Breaker → Retry Strategy → Alternate Provider
• ↓
• Dead Letter Queue
Provider Failover System
• Primary Provider → Circuit Breaker → Secondary Provider → Tertiary Provider
Special Considerations:
Fault-tolerance mechanisms
• Circuit breaker pattern
• Retry strategies
• Provider failover
• Dead letter queue
Validation flow
• Request validation middleware
• Schema validation
• Provider-specific validation
Monitoring points
• Circuit breaker status
• Queue depths
• Provider health
• Failover paths
• Component types
• Status indicators
• Integration points