Skip to content

feat: 콜벤 기능 구현#2151

Open
DHkimgit wants to merge 10 commits intodevelopfrom
feat/2150-callvan-sprint
Open

feat: 콜벤 기능 구현#2151
DHkimgit wants to merge 10 commits intodevelopfrom
feat/2150-callvan-sprint

Conversation

@DHkimgit
Copy link
Collaborator

@DHkimgit DHkimgit commented Feb 11, 2026

🔍 개요

  • 신고 기능을 제외한 콜벤 도메인 구현

🚀 주요 변경 내용

비동기 이벤트 기반 알림 저장 구현

  • Spring의 ApplicationEventPublisher@TransactionalEventListener를 활용하여 도메인 이벤트 기반 알림 시스템을 구현
  • 구현된 알림 타입
    • RECRUITMENT_COMPLETE : 모집 인원 마감 시
    • NEW_MESSAGE : 새로운 채팅 메시지 수신 시
    • PARTICIPANT_JOINED : 새로운 참여자 합류 시
    • DEPARTURE_UPCOMING : 출발 30분 전 알림
sequenceDiagram
    participant Client
    participant Controller
    participant Service
    participant EventPublisher
    participant EventListener
    participant NotificationService
    participant DB

    Client->>Controller: POST /callvan/posts/{id}/participants
    Controller->>Service: join(postId, userId)
    Service->>DB: 참여자 저장
    Service->>EventPublisher: publishEvent(ParticipantJoinedEvent)
    Service-->>Controller: 완료
    Controller-->>Client: 201 Created
    
    Note over EventPublisher,EventListener: 트랜잭션 커밋 후 비동기 실행
    
    EventPublisher->>EventListener: @TransactionalEventListener
    EventListener->>NotificationService: notifyParticipantJoined()
    NotificationService->>DB: 알림 저장 (다른 참여자들에게)
Loading

Redis Sorted Set(ZSET) 기반 지연 작업 큐

  • 출발 30분 전 알림을 효율적으로 처리하기 위해 Redis Sorted Set을 활용하여 지연 작업 큐를 구현
  • 매 분마다 스케줄러가 실행되지만 출발 30분 전 1번만 RDB 조회/삽입 작업 수행
sequenceDiagram
    participant PostCreate as 게시글 생성
    participant Scheduler as CallvanNotificationScheduler
    participant Redis as Redis Sorted Set
    participant CronJob as @Scheduled (매분 실행)
    participant DB as Database

    PostCreate->>Scheduler: scheduleNotification(post)
    Scheduler->>Scheduler: 출발시간 - 30분 계산
    Scheduler->>Redis: ZADD (score: timestamp)
    Note over Redis: Key: callvan:notification:queue<br/>Score: 알림 발송 시각 (epoch)

    loop 매분마다
        CronJob->>Redis: ZRANGEBYSCORE (0, now)
        Redis-->>CronJob: 발송 시각 도래한 작업들
        CronJob->>DB: 참여자들에게 알림 생성
        CronJob->>Redis: ZREM (처리 완료된 작업 제거)
    end
Loading
  • DB 폴링 대비 Redis 활용으로 성능 향상 기대

콜벤 가입 API 동시성 제어 적용

@Transactional
@ConcurrencyGuard(lockName = "callvanJoin")
public void join(Integer postId, Integer userId) {

💬 참고 사항

  • 구현 단위로 커밋 나눠놨습니다.

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • [] 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@DHkimgit DHkimgit self-assigned this Feb 11, 2026
@DHkimgit DHkimgit added 기능 새로운 기능을 개발합니다. Team Campus 캠퍼스 팀에서 작업할 이슈입니다 labels Feb 11, 2026
@github-actions
Copy link

Unit Test Results

673 tests   670 ✔️  1m 19s ⏱️
165 suites      3 💤
165 files        0

Results for commit a01d3ef.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team Campus 캠퍼스 팀에서 작업할 이슈입니다 기능 새로운 기능을 개발합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] 콜벤 스프린트 기본 기능 구현

1 participant