@node-ts/bus-core
Advanced tools
Comparing version 0.6.6 to 0.6.7
@@ -19,3 +19,4 @@ import { Logger } from '@node-ts/logger-core'; | ||
registerHandler(handler: ClassConstructor<Handler<MessageType>>): void; | ||
private connectTransport; | ||
private initializeTransport; | ||
} |
@@ -23,2 +23,3 @@ "use strict"; | ||
this.handlerRegistry.bindHandlersToContainer(container); | ||
await this.connectTransport(); | ||
await this.initializeTransport(); | ||
@@ -37,3 +38,3 @@ await this.bus.start(); | ||
this.logger.info('Initializing send only bus application...'); | ||
await this.initializeTransport(); | ||
await this.connectTransport(); | ||
this.isInitialized = true; | ||
@@ -51,2 +52,5 @@ this.logger.info('Send only bus application initialized'); | ||
} | ||
if (this.transport.disconnect) { | ||
await this.transport.disconnect(); | ||
} | ||
this.logger.info('Bus application disposed'); | ||
@@ -65,2 +69,7 @@ } | ||
} | ||
async connectTransport() { | ||
if (this.transport.connect) { | ||
await this.transport.connect(); | ||
} | ||
} | ||
async initializeTransport() { | ||
@@ -67,0 +76,0 @@ if (this.transport.initialize) { |
@@ -49,2 +49,12 @@ import { Event, Command, MessageAttributes } from '@node-ts/bus-messages'; | ||
/** | ||
* An optional function that will be called on startup. This gives a chance for the transport | ||
* to establish any connections to the underlying infrastructure. | ||
*/ | ||
connect?(): Promise<void>; | ||
/** | ||
* An optional function that will be called on shutdown. This gives a chance for the transport | ||
* to close any connections to the underlying infrastructure. | ||
*/ | ||
disconnect?(): Promise<void>; | ||
/** | ||
* An optional function that will be called when the service bus is starting. This is an | ||
@@ -51,0 +61,0 @@ * opportunity for the transport to see what messages need to be handled so that subscriptions |
{ | ||
"name": "@node-ts/bus-core", | ||
"version": "0.6.6", | ||
"version": "0.6.7", | ||
"description": "A service bus for message-based, distributed node applications", | ||
@@ -50,3 +50,3 @@ "main": "./dist/index.js", | ||
], | ||
"gitHead": "9c29dcef5e9a60c07f1d9716598e6f64bfc024c3" | ||
"gitHead": "3796ca2bd196f496f5cd917d478c644ea148c622" | ||
} |
@@ -29,2 +29,3 @@ import { LOGGER_SYMBOLS, Logger } from '@node-ts/logger-core' | ||
this.handlerRegistry.bindHandlersToContainer(container) | ||
await this.connectTransport() | ||
await this.initializeTransport() | ||
@@ -44,3 +45,3 @@ await this.bus.start() | ||
this.logger.info('Initializing send only bus application...') | ||
await this.initializeTransport() | ||
await this.connectTransport() | ||
this.isInitialized = true | ||
@@ -63,2 +64,6 @@ this.logger.info('Send only bus application initialized') | ||
if (this.transport.disconnect) { | ||
await this.transport.disconnect() | ||
} | ||
this.logger.info('Bus application disposed') | ||
@@ -89,2 +94,8 @@ } | ||
private async connectTransport (): Promise<void> { | ||
if (this.transport.connect) { | ||
await this.transport.connect() | ||
} | ||
} | ||
private async initializeTransport (): Promise<void> { | ||
@@ -91,0 +102,0 @@ if (this.transport.initialize) { |
@@ -56,2 +56,14 @@ import { Event, Command, MessageAttributes, Message } from '@node-ts/bus-messages' | ||
/** | ||
* An optional function that will be called on startup. This gives a chance for the transport | ||
* to establish any connections to the underlying infrastructure. | ||
*/ | ||
connect? (): Promise<void> | ||
/** | ||
* An optional function that will be called on shutdown. This gives a chance for the transport | ||
* to close any connections to the underlying infrastructure. | ||
*/ | ||
disconnect? (): Promise<void> | ||
/** | ||
* An optional function that will be called when the service bus is starting. This is an | ||
@@ -68,2 +80,3 @@ * opportunity for the transport to see what messages need to be handled so that subscriptions | ||
dispose? (): Promise<void> | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186367
3511