-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: persist mediator routing keys * fix: services were not reassigned * test: add mediation recipient restart test * fix: add timeout to return when is connected * refactor: extract pickup logic from ws transport * feat: return mediation record from provision * refactor: connection id instead of record Signed-off-by: Timo Glastra <timo@animo.id>
- Loading branch information
1 parent
56cb9f2
commit 163cda1
Showing
13 changed files
with
337 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/core/src/modules/routing/repository/MediatorRoutingRecord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { TagsBase } from '../../../storage/BaseRecord' | ||
|
||
import { BaseRecord } from '../../../storage/BaseRecord' | ||
import { uuid } from '../../../utils/uuid' | ||
|
||
export interface MediatorRoutingRecordProps { | ||
id?: string | ||
createdAt?: Date | ||
routingKeys?: string[] | ||
tags?: TagsBase | ||
} | ||
|
||
export class MediatorRoutingRecord extends BaseRecord implements MediatorRoutingRecordProps { | ||
public routingKeys!: string[] | ||
|
||
public static readonly type = 'MediatorRoutingRecord' | ||
public readonly type = MediatorRoutingRecord.type | ||
|
||
public constructor(props: MediatorRoutingRecordProps) { | ||
super() | ||
|
||
if (props) { | ||
this.id = props.id ?? uuid() | ||
this.createdAt = props.createdAt ?? new Date() | ||
this.routingKeys = props.routingKeys || [] | ||
} | ||
} | ||
|
||
public getTags() { | ||
return this._tags | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/core/src/modules/routing/repository/MediatorRoutingRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { inject, scoped, Lifecycle } from 'tsyringe' | ||
|
||
import { InjectionSymbols } from '../../../constants' | ||
import { Repository } from '../../../storage/Repository' | ||
import { StorageService } from '../../../storage/StorageService' | ||
|
||
import { MediatorRoutingRecord } from './MediatorRoutingRecord' | ||
|
||
@scoped(Lifecycle.ContainerScoped) | ||
export class MediatorRoutingRepository extends Repository<MediatorRoutingRecord> { | ||
public readonly MEDIATOR_ROUTING_RECORD_ID = 'MEDIATOR_ROUTING_RECORD' | ||
|
||
public constructor(@inject(InjectionSymbols.StorageService) storageService: StorageService<MediatorRoutingRecord>) { | ||
super(MediatorRoutingRecord, storageService) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './MediationRepository' | ||
export * from './MediatorRoutingRepository' | ||
export * from './MediationRecord' | ||
export * from './MediatorRoutingRecord' |
Oops, something went wrong.