Skip to content

Commit 530b213

Browse files
authored
Merge pull request #112 from Central-MakeUs/dev
[운영 배포]
2 parents 03afac1 + 029fcba commit 530b213

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

yakssok/src/main/java/server/yakssok/domain/medication_schedule/batch/job/MedicationRemindAlarmJob.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.Map;
66
import java.util.stream.Collectors;
77

8-
import org.springframework.amqp.rabbit.core.RabbitTemplate;
98
import org.springframework.stereotype.Component;
109
import org.springframework.transaction.annotation.Transactional;
1110

@@ -15,16 +14,13 @@
1514
import server.yakssok.domain.medication_schedule.domain.repository.MedicationScheduleRepository;
1615
import server.yakssok.domain.notification.application.service.PushService;
1716
import server.yakssok.domain.notification.presentation.dto.NotificationDTO;
18-
import server.yakssok.global.infra.rabbitmq.properties.MedicationQueueProperties;
1917

2018
@Component
2119
@RequiredArgsConstructor
2220
public class MedicationRemindAlarmJob {
2321

2422
private final PushService pushService;
2523
private final MedicationScheduleRepository medicationScheduleRepository;
26-
private final RabbitTemplate rabbitTemplate;
27-
private final MedicationQueueProperties medicationQueueProperties;
2824
private final OverduePolicy overduePolicy;
2925

3026
@Transactional
@@ -38,13 +34,12 @@ public void sendNotTakenRemindMedicationAlarms() {
3834
notTakenSchedules.stream().collect(Collectors.groupingBy(MedicationScheduleAlarmDto::userId));
3935
for (Map.Entry<Long, List<MedicationScheduleAlarmDto>> entry : byUser.entrySet()) {
4036
MedicationScheduleAlarmDto schedule = entry.getValue().get(0);
41-
sendToMedicationQueue(NotificationDTO.fromNotTakenMedicationSchedule(schedule));
37+
sendNotification(schedule);
4238
}
4339
}
4440

45-
private void sendToMedicationQueue(NotificationDTO notificationDTO) {
46-
String exchange = medicationQueueProperties.exchange();
47-
String routingKey = medicationQueueProperties.routingKey();
48-
rabbitTemplate.convertAndSend(exchange, routingKey, notificationDTO);
41+
private void sendNotification(MedicationScheduleAlarmDto schedule) {
42+
NotificationDTO notificationDTO = NotificationDTO.fromMedicationSchedule(schedule);
43+
pushService.sendNotification(notificationDTO);
4944
}
5045
}

0 commit comments

Comments
 (0)