File tree Expand file tree Collapse file tree
src/main/kotlin/org/gitanimals Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import org.gitanimals.notification.app.event.DeadLetterEvent
66import org.gitanimals.notification.domain.Notification
77import org.gitanimals.notification.domain.Notification.ActionRequest
88import org.gitanimals.notification.domain.Notification.ActionRequest.Style.PRIMARY
9+ import org.slf4j.LoggerFactory
910import org.springframework.beans.factory.annotation.Qualifier
1011import org.springframework.beans.factory.annotation.Value
1112import org.springframework.data.redis.connection.Message
@@ -18,7 +19,9 @@ class SlackDeadLetterMessageListener(
1819 private val objectMapper : ObjectMapper ,
1920 @Qualifier(" gitAnimalsDeadLetterSlackNotification" ) private val notification : Notification ,
2021 @Value(" \$ {relay.approve.token}" ) private val approveToken : String ,
21- ): TraceableMessageListener(redisTemplate, objectMapper) {
22+ ) : TraceableMessageListener(redisTemplate, objectMapper) {
23+
24+ private val logger = LoggerFactory .getLogger(this ::class .simpleName)
2225
2326 override fun onMessage (message : Message ) {
2427 runCatching {
@@ -51,6 +54,8 @@ class SlackDeadLetterMessageListener(
5154 )
5255 ),
5356 )
57+ }.onFailure {
58+ logger.error(" Fail to notify dead letter. message: $message " , it)
5459 }
5560 }
5661}
Original file line number Diff line number Diff line change 11package org.gitanimals.notification.app.event
22
3- import org.rooftop.netx.api.SagaEvent
4-
53data class DeadLetterEvent (
64 val traceId : String ,
75 val deadLetterId : String ,
8- val sagaEvent : SagaEvent ,
6+ val sagaId : String ,
7+ val nodeName : String ,
8+ val group : String ,
9+ val deadLetter : String ,
910)
Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ import org.gitanimals.core.IdGenerator
44import org.gitanimals.core.filter.MDCFilter
55import org.gitanimals.core.redis.AsyncRedisPubSubEvent
66import org.gitanimals.core.redis.RedisPubSubChannel.DEAD_LETTER_OCCURRED
7- import org.rooftop.netx.api.SagaEvent
87import org.slf4j.MDC
98
109data class DeadLetterEvent (
11- private val deadLetterId : String ,
12- private val sagaEvent : SagaEvent
13- ): AsyncRedisPubSubEvent(
10+ val deadLetterId : String ,
11+ val sagaId : String ,
12+ val nodeName : String ,
13+ val group : String ,
14+ val deadLetter : String ,
15+ ) : AsyncRedisPubSubEvent(
1416 traceId = runCatching { MDC .get(MDCFilter .TRACE_ID ) }
1517 .getOrElse { IdGenerator .generate().toString() },
1618 channel = DEAD_LETTER_OCCURRED ,
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ class DeadLetterEventPublisher(
1717 applicationEventPublisher.publishEvent(
1818 DeadLetterEvent (
1919 deadLetterId = deadLetterId,
20- sagaEvent = sagaEvent,
20+ sagaId = sagaEvent.id,
21+ group = sagaEvent.group,
22+ nodeName = sagaEvent.nodeName,
23+ deadLetter = sagaEvent.decodeEvent(String ::class ),
2124 )
2225 )
2326 }.also {
You can’t perform that action at this time.
0 commit comments