@highoutput/amqp
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -29,3 +29,6 @@ import Client, { ClientOptions } from './lib/client'; | ||
createWorker<TInput extends any[] = any[], TOutput = any>(queue: string, handler: (...args: TInput) => Promise<TOutput>, options?: Partial<WorkerOptions>): Promise<Worker<TInput, TOutput>>; | ||
createPublisher<TInput extends any[] = any[]>(topic: string, options?: Partial<PublisherOptions>): Promise<Publisher<TInput>>; | ||
createPublisher<TInput extends any[] = any[]>(topic: string, options?: Partial<PublisherOptions>): Promise<{ | ||
(...args: TInput): void; | ||
publisher: Publisher<TInput>; | ||
}>; | ||
createSubscriber<TInput extends any[] = any[]>(topic: string, handler: (...args: TInput) => Promise<void>, options?: Partial<SubscriberOptions>): Promise<Subscriber<TInput>>; | ||
@@ -32,0 +35,0 @@ stop(): Promise<void>; |
@@ -68,6 +68,8 @@ "use strict"; | ||
await publisher.start(); | ||
const func = (...args) => publisher.send(...args); | ||
func.publisher = publisher; | ||
const id = uuid_1.default(); | ||
this.publishers.set(id, publisher); | ||
publisher.once('stop', () => this.publishers.delete(id)); | ||
return publisher; | ||
return func; | ||
} | ||
@@ -74,0 +76,0 @@ async createSubscriber(topic, handler, options) { |
{ | ||
"name": "@highoutput/amqp", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"description": "A simplified abstraction of the AMQP 1.0 protocol", | ||
@@ -52,3 +52,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "56ba5b54bddc387651974889b1aa005c97e7ff14" | ||
"gitHead": "3fd90ae8a4d8f62c7a2c6d4b40858a2cb357ae40" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53156
678