UNPKG

@betit/orion

Version:

Pluggable microservice framework

37 lines (36 loc) 1.01 kB
import { Options } from '../types/interfaces'; import { default as Client } from '../client'; /** * Provides an interface to create your service and register request handlers. */ export default class Service extends Client { name: string; protected options: Options; id: string; /** * Create new service. */ constructor(name: string, options?: Options); /** * Subscribe to a topic. * @param {string} topic * @param {Function} callback */ on(topic: string, callback: Function, disableGroup?: boolean): any; /** * Register request handler method. * @param {string} method * @param {Function} callback * @param {string} [prefix] */ handle(path: string, callback: Function, prefix?: string): void; /** * Start listenning on the underlying transport connection. * @param {Function} callback */ listen(callback: Function): void; /** * Service name and id. */ toString(): string; }