Skip to content

Commit

Permalink
fix(routing): also use pickup strategy from config (#808)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored May 30, 2022
1 parent 656ed73 commit fd08ae3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/modules/routing/RecipientModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -173,7 +173,7 @@ export class RecipientModule {
}
})
try {
if (mediator.pickupStrategy === MediatorPickupStrategy.Implicit) {
if (pickupStrategy === MediatorPickupStrategy.Implicit) {
await this.openMediationWebSocket(mediator)
}
} catch (error) {
Expand All @@ -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: {
Expand All @@ -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(
Expand Down

0 comments on commit fd08ae3

Please sign in to comment.