Merge pull request #17953 from backstage/rugvip/startup
backend-app-api: parallelize plugin startup, introduce startup hook and middleware
This commit is contained in:
@@ -273,6 +273,10 @@ export interface LifecycleService {
|
||||
hook: LifecycleServiceShutdownHook,
|
||||
options?: LifecycleServiceShutdownOptions,
|
||||
): void;
|
||||
addStartupHook(
|
||||
hook: LifecycleServiceStartupHook,
|
||||
options?: LifecycleServiceStartupOptions,
|
||||
): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -283,6 +287,14 @@ export interface LifecycleServiceShutdownOptions {
|
||||
logger?: LoggerService;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type LifecycleServiceStartupHook = () => void | Promise<void>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface LifecycleServiceStartupOptions {
|
||||
logger?: LoggerService;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface LoggerService {
|
||||
// (undocumented)
|
||||
|
||||
@@ -16,6 +16,21 @@
|
||||
|
||||
import { LoggerService } from './LoggerService';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type LifecycleServiceStartupHook = () => void | Promise<void>;
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface LifecycleServiceStartupOptions {
|
||||
/**
|
||||
* Optional {@link LoggerService} that will be used for logging instead of the default logger.
|
||||
*/
|
||||
logger?: LoggerService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
@@ -35,6 +50,20 @@ export interface LifecycleServiceShutdownOptions {
|
||||
* @public
|
||||
*/
|
||||
export interface LifecycleService {
|
||||
/**
|
||||
* Register a function to be called when the backend has been initialized.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* When used with plugin scope it will wait for the plugin itself to have been initialized.
|
||||
*
|
||||
* When used with root scope it will wait for all plugins to have been initialized.
|
||||
*/
|
||||
addStartupHook(
|
||||
hook: LifecycleServiceStartupHook,
|
||||
options?: LifecycleServiceStartupOptions,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Register a function to be called when the backend is shutting down.
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,8 @@ export type { DiscoveryService } from './DiscoveryService';
|
||||
export type { HttpRouterService } from './HttpRouterService';
|
||||
export type {
|
||||
LifecycleService,
|
||||
LifecycleServiceStartupHook,
|
||||
LifecycleServiceStartupOptions,
|
||||
LifecycleServiceShutdownHook,
|
||||
LifecycleServiceShutdownOptions,
|
||||
} from './LifecycleService';
|
||||
|
||||
Reference in New Issue
Block a user