From fd08ae3afaa334c4644aaacee2b6547f171d9d7d Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Mon, 30 May 2022 09:30:34 +0200 Subject: [PATCH] fix(routing): also use pickup strategy from config (#808) Signed-off-by: Timo Glastra --- packages/core/src/modules/routing/RecipientModule.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/modules/routing/RecipientModule.ts b/packages/core/src/modules/routing/RecipientModule.ts index 5849556b1c..06916be812 100644 --- a/packages/core/src/modules/routing/RecipientModule.ts +++ b/packages/core/src/modules/routing/RecipientModule.ts @@ -137,7 +137,7 @@ export class RecipientModule { }) } - private async openWebSocketAndPickUp(mediator: MediationRecord) { + private async openWebSocketAndPickUp(mediator: MediationRecord, pickupStrategy: MediatorPickupStrategy) { let interval = 50 // Listens to Outbound websocket closed events and will reopen the websocket connection @@ -162,7 +162,7 @@ export class RecipientModule { `Websocket connection to mediator with connectionId '${mediator.connectionId}' is closed, attempting to reconnect...` ) try { - if (mediator.pickupStrategy === MediatorPickupStrategy.PickUpV2) { + if (pickupStrategy === MediatorPickupStrategy.PickUpV2) { // Start Pickup v2 protocol to receive messages received while websocket offline await this.sendStatusRequest({ mediatorId: mediator.id }) } else { @@ -173,7 +173,7 @@ export class RecipientModule { } }) try { - if (mediator.pickupStrategy === MediatorPickupStrategy.Implicit) { + if (pickupStrategy === MediatorPickupStrategy.Implicit) { await this.openMediationWebSocket(mediator) } } catch (error) { @@ -189,7 +189,7 @@ export class RecipientModule { switch (mediatorPickupStrategy) { case MediatorPickupStrategy.PickUpV2: this.agentConfig.logger.info(`Starting pickup of messages from mediator '${mediator.id}'`) - await this.openWebSocketAndPickUp(mediator) + await this.openWebSocketAndPickUp(mediator, mediatorPickupStrategy) await this.sendStatusRequest({ mediatorId: mediator.id }) break case MediatorPickupStrategy.PickUpV1: { @@ -206,7 +206,7 @@ export class RecipientModule { // Implicit means sending ping once and keeping connection open. This requires a long-lived transport // such as WebSockets to work this.agentConfig.logger.info(`Starting implicit pickup of messages from mediator '${mediator.id}'`) - await this.openWebSocketAndPickUp(mediator) + await this.openWebSocketAndPickUp(mediator, mediatorPickupStrategy) break default: this.agentConfig.logger.info(