File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
libs/messaging/src/main/kotlin/uk/gov/justice/digital/hmpps/listener Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package uk.gov.justice.digital.hmpps.listener
2
2
3
3
import com.fasterxml.jackson.databind.ObjectMapper
4
4
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
5
+ import io.awspring.cloud.sqs.SqsException
5
6
import io.awspring.cloud.sqs.annotation.SqsListener
6
7
import io.awspring.cloud.sqs.listener.AsyncAdapterBlockingExecutionFailedException
7
8
import io.awspring.cloud.sqs.listener.ListenerExecutionFailedException
@@ -76,8 +77,10 @@ class AwsNotificationListener(
76
77
try {
77
78
visibility.changeTo(30 )
78
79
} catch (e: Exception ) {
79
- telemetryService.trackException(e)
80
- Sentry .captureException(e)
80
+ if (e.cause !is SqsException || e.cause?.message?.contains(MESSAGE_ACKNOWLEDGED ) != true ) {
81
+ telemetryService.trackException(e)
82
+ Sentry .captureException(e)
83
+ }
81
84
}
82
85
}, Duration .ofSeconds(visibilityExtensionInterval))
83
86
}
@@ -105,6 +108,7 @@ class AwsNotificationListener(
105
108
}
106
109
107
110
companion object {
111
+ const val MESSAGE_ACKNOWLEDGED = " Message does not exist or is not available for visibility timeout change"
108
112
val RETRYABLE_EXCEPTIONS = listOf (
109
113
RestClientException ::class ,
110
114
CancellationException ::class ,
You can’t perform that action at this time.
0 commit comments