mirror of
https://github.com/corda/corda.git
synced 2025-05-05 02:03:06 +00:00
ndoe: Fix message duping on redelivery
This commit is contained in:
parent
89a5448c39
commit
cc556cde6f
@ -86,7 +86,7 @@ class ArtemisMessagingClient(directory: Path,
|
|||||||
private val handlers = CopyOnWriteArrayList<Handler>()
|
private val handlers = CopyOnWriteArrayList<Handler>()
|
||||||
|
|
||||||
// TODO: This is not robust and needs to be replaced by more intelligently using the message queue server.
|
// TODO: This is not robust and needs to be replaced by more intelligently using the message queue server.
|
||||||
private val undeliveredMessages = CopyOnWriteArrayList<Message>()
|
private var undeliveredMessages = listOf<Message>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(directory.fileSystem == FileSystems.getDefault()) { "Artemis only uses the default file system" }
|
require(directory.fileSystem == FileSystems.getDefault()) { "Artemis only uses the default file system" }
|
||||||
@ -312,7 +312,9 @@ class ArtemisMessagingClient(directory: Path,
|
|||||||
require(!topicSession.isBlank()) { "Topic must not be blank, as the empty topic is a special case." }
|
require(!topicSession.isBlank()) { "Topic must not be blank, as the empty topic is a special case." }
|
||||||
val handler = Handler(executor, topicSession, callback)
|
val handler = Handler(executor, topicSession, callback)
|
||||||
handlers.add(handler)
|
handlers.add(handler)
|
||||||
undeliveredMessages.removeIf { deliver(it) }
|
val messagesToRedeliver = undeliveredMessages
|
||||||
|
undeliveredMessages = listOf()
|
||||||
|
messagesToRedeliver.forEach { deliver(it) }
|
||||||
return handler
|
return handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user