node-universe
Version:
基于 Nodejs 环境的一款微服务框架,原理来自于宇宙中的恒星,行星,卫星等系统。
27 lines (26 loc) • 913 B
TypeScript
import Service from '../../lib/star/service';
import { ActionHandler, ActionParams, BulkheadOptions } from '.';
import { TracingEventOptions } from '../tracing';
import Context from '../../lib/context';
export interface EventSchema {
name?: string;
group?: string;
params?: ActionParams;
service?: Service;
tracing?: boolean | TracingEventOptions;
bulkhead?: BulkheadOptions;
handler?: ActionHandler;
context?: boolean;
[key: string]: any;
}
export type ServiceEventLegacyHandler = (payload: any, sender: string, eventName: string, ctx: Context) => void | Promise<void>;
export type ServiceEventHandler = (ctx: Context) => void | Promise<void>;
export interface ServiceEvent {
name?: string;
group?: string;
params?: ActionParams;
context?: boolean;
debounce?: number;
throttle?: number;
handler?: ServiceEventHandler | ServiceEventLegacyHandler;
}