-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Refactor/#117 - 이벤트 Consume 로직에 Job 삭제 로직 추가
- Loading branch information
1 parent
6785dff
commit 4e1c054
Showing
2 changed files
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...daon/onjung/event/application/controller/consumer/EventSchedulerConsumerV1Controller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
package com.daon.onjung.event.application.controller.consumer; | ||
|
||
import com.daon.onjung.core.repository.redis.ScheduledEventJobRepository; | ||
import com.daon.onjung.event.application.usecase.ProcessCompletedEventUseCase; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.quartz.Job; | ||
import org.quartz.JobExecutionContext; | ||
import org.quartz.JobExecutionException; | ||
|
||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class EventSchedulerConsumerV1Controller implements Job { | ||
|
||
private final ProcessCompletedEventUseCase processCompletedEventUseCase; | ||
private final ScheduledEventJobRepository scheduledEventJobRepository; | ||
|
||
@Override | ||
public void execute(JobExecutionContext context) throws JobExecutionException { | ||
// JobDataMap을 통해 eventId를 가져온다. | ||
Long eventId = context.getJobDetail().getJobDataMap().getLong("eventId"); | ||
|
||
// eventId를 통해 ScheduledEventJob을 삭제 | ||
scheduledEventJobRepository.deleteById(eventId.toString()); | ||
log.info("ScheduledEventJob 삭제 완료. eventId: {}", eventId); | ||
|
||
processCompletedEventUseCase.execute(eventId); | ||
} | ||
} |