|
|
@ -147,7 +147,7 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
|
|
|
|
|
|
|
|
|
|
|
/** Connect an external event bus to this bus. */
|
|
|
|
/** Connect an external event bus to this bus. */
|
|
|
|
async connect(bus: EventBus): Promise<void> {
|
|
|
|
async connect(bus: EventBus): Promise<void> {
|
|
|
|
if ( this.isUp ) {
|
|
|
|
if ( this.isUp && !bus.isConnected() ) {
|
|
|
|
await bus.up()
|
|
|
|
await bus.up()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -167,6 +167,10 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isConnected(): boolean {
|
|
|
|
|
|
|
|
return this.isUp
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async disconnect(bus: EventBus): Promise<void> {
|
|
|
|
async disconnect(bus: EventBus): Promise<void> {
|
|
|
|
await this.subscriptions
|
|
|
|
await this.subscriptions
|
|
|
|
.where('busUuid', '=', bus.uuid)
|
|
|
|
.where('busUuid', '=', bus.uuid)
|
|
|
@ -202,7 +206,9 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await this.connectors.awaitMapCall('up')
|
|
|
|
await this.connectors
|
|
|
|
|
|
|
|
.filter(bus => !bus.isConnected())
|
|
|
|
|
|
|
|
.awaitMapCall('up')
|
|
|
|
|
|
|
|
|
|
|
|
this.isUp = true
|
|
|
|
this.isUp = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|