in ses-plugin-server/src/main/kotlin/jetbrains/buildServer/sesPlugin/sqs/BounceMessageHandler.kt [18:77]
override fun handle(data: SESNotification) {
if (data !is SESBounceNotification) throw IllegalArgumentException()
val bounceType = data.getBounceType()
when {
isCriticalBounce(bounceType) -> {
val emails = data.getRecipients().asSequence().map {
val email = it.emailAddress
logService.log {
if (data.getBounceSubType() == "Suppressed") {
if (logger.isDebugEnabled) {
logger.info("Got suppressed bounce for email '$email'")
} else {
logger.debug("Got suppressed bounce for email '$email': $data")
}
} else {
if (logger.isDebugEnabled) {
logger.debug("Got hard bounce for email '$email': $data")
} else {
logger.info("Got hard bounce for email '$email'")
}
}
}
email
}
try {
bounceHandler.handleBounces(emails)
} catch (e: Exception) {
logService.log {
logger.warnAndDebugDetails("Exception occurred while handling bounces", e)
}
}
}
isHandableBounce(bounceType) -> {
logger.debug("Got soft bounce (${data.getBounceSubType()})")
// when (data.getBounceSubType()) {
// "MessageTooLarge" -> {
// }
// "ContentRejected" -> {
// }
// "AttachmentRejected" -> {
// }
// "General" -> {
// }
// "MailboxFull" -> {
// }
// else -> {
// }
// }
}
else -> logService.log {
logger.warn("Got unknown bounce type $data")
}
}
}