@betit/orion
Version:
Pluggable microservice framework
32 lines (31 loc) • 965 B
TypeScript
export interface Codec {
encoding?: string;
contentType?: string;
encode(data: any): any;
decode(data: any): any;
}
export interface Transport {
listen(callback: Function): any;
publish(topic: string, message: any): any;
subscribe(topic: string, group: string, callback: Function): any;
handle(route: string, group: string, callback: Function): any;
request(route: string, payload: any, callback: Function, timeout: number): any;
close(): any;
onClose(callback: Function): any;
}
export interface Client {
emit(topic: string, message: any): any;
call(request: any, callback: Function): any;
}
export interface Service {
emit(topic: string, message: any): any;
on(topic: string, callback: Function): any;
handle(method: string, callback: Function): any;
}
export interface Options {
codec?: Codec;
transport?: Transport;
callTimeout?: number;
callTimeouts?: {};
service?: string;
}