mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
ENT-2835: handle uncaught exception when bridge tries to send a message using a disconnected amqp client (#4399)
* ENT-2835: handle uncaught exception when bridge tries to send a message using a disconnected amqp client * ENT-2835: remove emptyline * ENT-2835: added comment explaining the exception handling
This commit is contained in:
parent
74a0a6116c
commit
749c207bad
@ -191,7 +191,18 @@ class AMQPBridgeManager(config: MutualSslConfiguration, maxMessageSize: Int,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
amqpClient.write(sendableMessage)
|
try {
|
||||||
|
amqpClient.write(sendableMessage)
|
||||||
|
} catch (ex: IllegalStateException) {
|
||||||
|
// Attempting to send a message while the AMQP client is disconnected may cause message loss.
|
||||||
|
// The failed message is rolled back after committing acknowledged messages.
|
||||||
|
lock.withLock {
|
||||||
|
ex.message?.let { logInfoWithMDC(it)}
|
||||||
|
logInfoWithMDC("Rollback rejected message uuid: ${artemisMessage.getObjectProperty("_AMQ_DUPL_ID")}")
|
||||||
|
session?.commit()
|
||||||
|
session?.rollback(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
bridgeMetricsService?.packetAcceptedEvent(sendableMessage)
|
bridgeMetricsService?.packetAcceptedEvent(sendableMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user