feat: 웹훅 발송 서비스 구현 (#146) #147

Merged
seonkyu.kim merged 1 commits from feature/#146-webhook-service into develop 2026-02-11 01:13:07 +00:00
Owner

📋 작업 요약

  • 이벤트 발생 시 등록된 Webhook URL로 HTTP POST 알림을 전송하는 서비스 구현
  • 재시도 정책: 최대 3회, 30초 간격
  • 최종 실패 시 WebhookLog에 기록

Closes #146

🛠️ 작업 내용 (Changes)

  • SPMS.Application/Interfaces/IWebhookService.cs — SendAsync(serviceId, eventType, data) 인터페이스
  • SPMS.Application/DTOs/Webhook/WebhookPayloadDto.cs — 페이로드 DTO (event_type, timestamp, service_code, data)
  • SPMS.Domain/Interfaces/IWebhookLogRepository.cs — Repository 인터페이스
  • SPMS.Infrastructure/Persistence/Repositories/WebhookLogRepository.cs — Repository 구현
  • SPMS.Infrastructure/Webhook/WebhookService.cs — HTTP 전송 + 재시도 + 로그 기록
  • SPMS.Infrastructure/DependencyInjection.cs — WebhookLogRepository, HttpClient, WebhookService DI 등록

📢 리뷰어 참고 사항 (To Reviewers)

  • SendAsync는 fire-and-forget 패턴 (Task.Run) — 호출자를 블로킹하지 않음
  • 구독되지 않은 이벤트는 발송하지 않음 (Service.WebhookEvents JSON 배열 체크)
  • IServiceProvider.CreateScope()로 별도 DI 스코프에서 DB 접근
  • 타임아웃 10초, 재시도 3회 (30초 간격), 최종 실패 시 WebhookLog 기록
  • ResponseBody는 2000자 제한으로 잘라서 저장

체크리스트 (Self Checklist)

  • 빌드(Build)가 성공적으로 수행되었는가?
  • 모든 단위 테스트(Unit Test)를 통과하였는가?
  • 불필요한 로그나 주석을 제거하였는가?
  • 컨벤션(Clean Architecture, Naming)을 준수하였는가?
  • 기밀 정보(비밀번호, 키 등)가 하드코딩 되어있지 않은가?

📸 스크린샷 / 테스트 로그 (Screenshots/Logs)

Build succeeded.
    0 Warning(s)
    0 Error(s)
## 📋 작업 요약 - 이벤트 발생 시 등록된 Webhook URL로 HTTP POST 알림을 전송하는 서비스 구현 - 재시도 정책: 최대 3회, 30초 간격 - 최종 실패 시 WebhookLog에 기록 ## 🔗 관련 이슈 (Related Issues) Closes #146 ## 🛠️ 작업 내용 (Changes) - [x] SPMS.Application/Interfaces/IWebhookService.cs — SendAsync(serviceId, eventType, data) 인터페이스 - [x] SPMS.Application/DTOs/Webhook/WebhookPayloadDto.cs — 페이로드 DTO (event_type, timestamp, service_code, data) - [x] SPMS.Domain/Interfaces/IWebhookLogRepository.cs — Repository 인터페이스 - [x] SPMS.Infrastructure/Persistence/Repositories/WebhookLogRepository.cs — Repository 구현 - [x] SPMS.Infrastructure/Webhook/WebhookService.cs — HTTP 전송 + 재시도 + 로그 기록 - [x] SPMS.Infrastructure/DependencyInjection.cs — WebhookLogRepository, HttpClient, WebhookService DI 등록 ## 📢 리뷰어 참고 사항 (To Reviewers) - SendAsync는 fire-and-forget 패턴 (Task.Run) — 호출자를 블로킹하지 않음 - 구독되지 않은 이벤트는 발송하지 않음 (Service.WebhookEvents JSON 배열 체크) - IServiceProvider.CreateScope()로 별도 DI 스코프에서 DB 접근 - 타임아웃 10초, 재시도 3회 (30초 간격), 최종 실패 시 WebhookLog 기록 - ResponseBody는 2000자 제한으로 잘라서 저장 ## ✅ 체크리스트 (Self Checklist) - [x] 빌드(Build)가 성공적으로 수행되었는가? - [x] 모든 단위 테스트(Unit Test)를 통과하였는가? - [x] 불필요한 로그나 주석을 제거하였는가? - [x] 컨벤션(Clean Architecture, Naming)을 준수하였는가? - [x] 기밀 정보(비밀번호, 키 등)가 하드코딩 되어있지 않은가? ## 📸 스크린샷 / 테스트 로그 (Screenshots/Logs) ``` Build succeeded. 0 Warning(s) 0 Error(s) ```
seonkyu.kim added this to the Phase 3-2: 통계 & Webhook & 배치 milestone 2026-02-11 01:10:51 +00:00
seonkyu.kim added 1 commit 2026-02-11 01:10:52 +00:00
seonkyu.kim added the
Priority
High
Status
In Progress
Type
Feature
labels 2026-02-11 01:11:30 +00:00
seonkyu.kim self-assigned this 2026-02-11 01:11:39 +00:00
seonkyu.kim requested review from Owners 2026-02-11 01:11:49 +00:00
seonkyu.kim merged commit 9ab7d4786d into develop 2026-02-11 01:13:07 +00:00
seonkyu.kim deleted branch feature/#146-webhook-service 2026-02-11 01:13:48 +00:00
seonkyu.kim added
Status
Done
and removed
Status
In Progress
labels 2026-02-11 01:14:03 +00:00
Sign in to join this conversation.
No description provided.