UNPKG

@betit/orion

Version:

Pluggable microservice framework

43 lines (42 loc) 1.05 kB
/** * NATS transport. */ export default class NatsTransport { private options; private client; /** * Create new NATS transport. */ constructor(options?: any); /** * Transport listen. */ listen(callback: Function): void; /** * Publish to a topic. */ publish(topic: string, message: any): void; /** * Subscribe to a topic. */ subscribe(topic: string, group: string, callback: Function): number; /** * Unsubscribe from a topic. */ unsubscribe(sid: number, max?: number): void; /** * Transport handle. */ handle(route: string, group: string, callback: Function): void; /** * Client request. * Nats client implements this pattern out of the box. * Publish a request with an implicit inbox listener as the response. * This should be treated as a subscription. */ request(route: string, payload: any, callback: Function, timeout?: number): void; /** * Close connection. */ close(): void; }