mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
CORDA-2861: give the message executor its own artemis session and producer (#5031)
This commit is contained in:
parent
5821ad5f5c
commit
33e9f125db
@ -108,6 +108,8 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
||||
var eventsSubscription: Subscription? = null
|
||||
var p2pConsumer: P2PMessagingConsumer? = null
|
||||
var locator: ServerLocator? = null
|
||||
var executorProducer: ClientProducer? = null
|
||||
var executorSession: ClientSession? = null
|
||||
var producer: ClientProducer? = null
|
||||
var producerSession: ClientSession? = null
|
||||
var bridgeSession: ClientSession? = null
|
||||
@ -171,8 +173,10 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
||||
// size of 1MB is acknowledged.
|
||||
val createNewSession = { sessionFactory!!.createSession(ArtemisMessagingComponent.NODE_P2P_USER, ArtemisMessagingComponent.NODE_P2P_USER, false, true, true, false, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE) }
|
||||
|
||||
executorSession = createNewSession()
|
||||
producerSession = createNewSession()
|
||||
bridgeSession = createNewSession()
|
||||
executorSession!!.start()
|
||||
producerSession!!.start()
|
||||
bridgeSession!!.start()
|
||||
|
||||
@ -180,6 +184,7 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
||||
// Create a queue, consumer and producer for handling P2P network messages.
|
||||
// Create a general purpose producer.
|
||||
producer = producerSession!!.createProducer()
|
||||
executorProducer = executorSession!!.createProducer()
|
||||
|
||||
inboxes += RemoteInboxAddress(myIdentity).queueName
|
||||
serviceIdentity?.let {
|
||||
@ -191,8 +196,8 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
||||
p2pConsumer = P2PMessagingConsumer(inboxes, createNewSession, isDrainingModeOn, drainingModeWasChangedEvents)
|
||||
|
||||
messagingExecutor = MessagingExecutor(
|
||||
producerSession!!,
|
||||
producer!!,
|
||||
executorSession!!,
|
||||
executorProducer!!,
|
||||
versionInfo,
|
||||
this@P2PMessagingClient,
|
||||
ourSenderUUID = ourSenderUUID
|
||||
@ -441,6 +446,10 @@ class P2PMessagingClient(val config: NodeConfiguration,
|
||||
producer = null
|
||||
producerSession!!.commit()
|
||||
|
||||
close(executorProducer)
|
||||
executorProducer = null
|
||||
executorSession!!.commit()
|
||||
|
||||
close(bridgeNotifyConsumer)
|
||||
knownQueues.clear()
|
||||
eventsSubscription?.unsubscribe()
|
||||
|
Loading…
Reference in New Issue
Block a user