Skip to content

feat: Implement notification service - #8

Merged
rezadrian01 merged 3 commits into
mainfrom
feature/notification-service
May 28, 2026
Merged

feat: Implement notification service#8
rezadrian01 merged 3 commits into
mainfrom
feature/notification-service

Conversation

@rezadrian01

Copy link
Copy Markdown
Owner

Summary

  • Stateless, event-driven email notification service (port 8086) with no database or cache
  • Consumes 6 Kafka topics: user.created, order.created, order.cancelled, payment.completed, payment.failed, inventory.low_stock
  • Sends welcome email on user.created via SMTP; logs and skips order/payment events (event payloads carry user_id UUID but not user email — no cross-service call to keep services decoupled)
  • SMTP sender using net/smtp stdlib; no-auth relay mode when SMTP_USER is empty (MailHog-compatible for dev)
  • Multi-topic Kafka consumer with one kafka.Reader per topic, consumer group notification-service
  • GET /health is the only HTTP endpoint; no auth middleware needed
  • docker-compose wired with KAFKA_BROKERS and kafka: service_healthy dependency

Test plan

  • Service starts and /health returns {"status":"healthy"}
  • user.created Kafka event triggers a welcome email to the user's address
  • order.created / order.cancelled events are consumed and logged (no email sent)
  • payment.completed / payment.failed events are consumed and logged (no email sent)
  • inventory.low_stock triggers a warn log with product_id and available quantity
  • Graceful shutdown closes all 6 Kafka readers cleanly

🤖 Generated with Claude Code

rezadrian01 and others added 3 commits May 28, 2026 16:13
7-task plan for a stateless, event-driven email notification service
consuming user.created, order.created/cancelled, payment.completed/failed,
and inventory.low_stock topics via Kafka and sending via SMTP.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd Kafka consumer

- Domain event structs matching producer JSON tags for user, order, payment, and inventory topics
- SMTP email sender using net/smtp stdlib with no-auth relay mode for dev (MailHog-compatible)
- Notification service sends welcome email on user.created; logs and skips order/payment events
  since those event payloads carry user_id (UUID) but not the user email address
- Multi-topic Kafka consumer with one kafka.Reader per topic, group notification-service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er-compose wiring

- Health handler + route (only HTTP surface; no auth middleware needed)
- cmd bootstrap: config reads SMTP_HOST/PORT/FROM/USER/PASS/SECURE and KAFKA_BROKERS;
  dotenv loader for dev; kafka setup/start/close helpers; Gin router in release mode
- Run() wires SMTP sender → service → Kafka consumer → HTTP server with graceful shutdown
- Dockerfile: golang:1.25-alpine builder → alpine:3.18 runtime, binary notification-service, EXPOSE 8086
- docker-compose: added KAFKA_BROKERS and kafka service_healthy dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 09:21
@rezadrian01
rezadrian01 merged commit e111d8c into main May 28, 2026
1 of 2 checks passed
@rezadrian01
rezadrian01 removed the request for review from Copilot May 28, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant