Skip to content

Commit

Permalink
[FEAT] deadletter queue 기존 큐와 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Mar 11, 2024
1 parent 95dc70d commit a0708f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public class RabbitMQConfig {

@Bean
public Queue locationQueue() {
return new Queue(RabbitMQConstant.LOCATION_QUEUE.getName(), true);
return QueueBuilder.durable(RabbitMQConstant.LOCATION_QUEUE.getName())
.withArgument("x-dead-letter-exchange", RabbitMQConstant.DEAD_LETTER_EXCHANGE.getName())
.withArgument("x-dead-letter-routing-key", RabbitMQConstant.DEAD_LETTER_ROUTING_KEY.getName())
.build();
}

@Bean
Expand All @@ -41,7 +44,10 @@ public Binding locationBinding() {

@Bean
public Queue notificationQueue() {
return new Queue(RabbitMQConstant.NOTIFICATION_QUEUE.getName(), true);
return QueueBuilder.durable(RabbitMQConstant.NOTIFICATION_QUEUE.getName())
.withArgument("x-dead-letter-exchange", RabbitMQConstant.DEAD_LETTER_EXCHANGE.getName())
.withArgument("x-dead-letter-routing-key", RabbitMQConstant.DEAD_LETTER_ROUTING_KEY.getName())
.build();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ public FcmConsumer(FirebaseMessaging firebaseMessaging) {
}

@RabbitListener(queues = "notification.queue")
public void sendNotification(final NotificationRequest request) {
try {
firebaseMessaging.send(request.toMessage());
} catch (FirebaseMessagingException e) {
log.error(e.getMessage());
}
public void sendNotification(final NotificationRequest request) throws FirebaseMessagingException {
firebaseMessaging.send(request.toMessage());
}
}

0 comments on commit a0708f6

Please sign in to comment.