Distributed Library System — Notification Service
分散型図書館システム — 通知サービス
The Notification Service is an asynchronous event-driven microservice responsible for delivering user-facing notifications across the distributed library platform.
It consumes domain events published by upstream services through Kafka and generates notification workflows without impacting transactional services.
The service currently processes user registration, borrowing, and return events, allowing business services to remain decoupled from notification concerns.
Unlike traditional Laravel web applications, this service operates as a background worker and Kafka consumer. It does not expose public REST APIs and runs on a lightweight PHP CLI runtime optimized for event processing.
Notification Service は分散型図書館システムにおける非同期通知サービスです。
Kafka を通じて配信されるドメインイベントを購読し、ユーザー向け通知処理を実行します。
本サービスはユーザー登録、貸出、返却イベントを処理し、通知機能を他サービスから分離することで疎結合なアーキテクチャを実現しています。
また、一般的な Laravel Web アプリケーションとは異なり、本サービスは REST API を提供せず、Kafka Consumer として PHP CLI 上で動作します。
- Notification event processing
- Kafka event consumption
- User registration notifications
- Borrow notifications
- Return notifications
- Notification workflow orchestration
- Asynchronous processing
- Event-driven integration
- User authentication
- User account management
- Borrow transaction processing
- Inventory management
- Analytics aggregation
- Catalog management
- Search indexing
- Consume domain events
- Process notification workflows
- Send registration notifications
- Send borrow notifications
- Send return notifications
- Maintain asynchronous communication
- Decouple notification concerns from business services
- ドメインイベント購読
- 通知処理実行
- ユーザー登録通知
- 貸出通知
- 返却通知
- 非同期通信管理
- 通知機能の疎結合化
| Category | Technology |
|---|---|
| Runtime | PHP 8.2 |
| Framework | Laravel 12 |
| Messaging | Kafka |
| Kafka Client | Laravel Kafka |
| Persistence | Stateless Consumer |
| Serialization | Spatie Laravel Data |
| Monitoring | OpenTelemetry |
| Containerization | Docker |
| Runtime Type | PHP CLI |
| CI/CD | GitHub Actions |
| Topic | Description |
|---|---|
| library.borrow.v1 | Borrow creation events |
| library.return.v1 | Return completion events |
| auth-create-topic | User registration events |
Borrow Event
↓
Kafka Consumer
↓
BookBorrowedHandler
↓
Notification Generation
↓
Email Delivery
Return Event
↓
Kafka Consumer
↓
BookReturnedHandler
↓
Notification Generation
↓
Email Delivery
User Created Event
↓
Kafka Consumer
↓
KafkaUserHandler
↓
Welcome Notification
↓
Email Delivery
Unlike a traditional Laravel application, this service does not expose HTTP endpoints.
It runs exclusively as Kafka consumers inside lightweight PHP CLI containers.
本サービスは HTTP API を提供しません。
軽量な PHP CLI コンテナ上で Kafka Consumer として動作します。
This service does not expose public REST APIs.
本サービスは REST API を公開していません。
- PHP 8.2
- Composer
- Docker
- Kafka
docker compose up --buildcomposer test- Unit tests
- Kafka consumer tests
- Handler tests
- Event processing tests
- Integration tests
含まれるテスト:
- ユニットテスト
- Kafka Consumer テスト
- Handler テスト
- イベント処理テスト
- 統合テスト
The CI pipeline enforces:
- Automated test execution
- Consumer validation
- Event contract verification
- Pull request validation
- Docker image publication
CI パイプラインでは以下を保証します:
- 自動テスト実行
- Consumer 検証
- イベント契約検証
- Pull Request 検証
- Docker イメージ配布
KAFKA_BROKERS=
KAFKA_CONSUMER_GROUP_ID=
OTEL_EXPORTER_OTLP_ENDPOINT=Environment-driven configuration.
環境変数ベースで構成されています。
OpenTelemetry tracing is enabled for event processing observability.
イベント処理の可観測性向上のため OpenTelemetry を利用しています。
The Notification Service represents the asynchronous communication layer of the distributed library system.
It allows transactional services to remain focused on business logic while notification concerns are processed independently through Kafka-based event consumption.
Notification Service は分散型図書館システムの非同期通知レイヤーとして機能します。
トランザクションサービスはビジネスロジックに集中し、通知処理は Kafka を介して独立して実行されます。
MIT