@golevelup/nestjs-rabbitmq
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [3.5.0](https://github.com/golevelup/nestjs/compare/@golevelup/nestjs-rabbitmq@3.4.0...@golevelup/nestjs-rabbitmq@3.5.0) (2023-02-23) | ||
### Features | ||
- **rabbitmq:** return promise from publish to be able to await delivery ([#530](https://github.com/golevelup/nestjs/issues/530)) ([7163eca](https://github.com/golevelup/nestjs/commit/7163ecaf948c96b081b803725c023cd75b99002a)) | ||
# [3.4.0](https://github.com/golevelup/nestjs/compare/@golevelup/nestjs-rabbitmq@3.3.0...@golevelup/nestjs-rabbitmq@3.4.0) (2022-10-31) | ||
@@ -8,0 +14,0 @@ |
import { ChannelWrapper, AmqpConnectionManager } from 'amqp-connection-manager'; | ||
import { ConsumeMessage, Channel, Connection, ConfirmChannel, Options } from 'amqplib'; | ||
import { Replies } from 'amqplib/properties'; | ||
import { MessageHandlerOptions, RabbitMQConfig, RequestOptions } from '../rabbitmq.interfaces'; | ||
@@ -51,3 +52,3 @@ import { RpcResponse, SubscribeResponse } from './handlerResponses'; | ||
get configuration(): Required<RabbitMQConfig>; | ||
get channels(): Record<string, Channel>; | ||
get channels(): Record<string, ConfirmChannel>; | ||
get managedChannels(): Record<string, ChannelWrapper>; | ||
@@ -64,3 +65,3 @@ get connected(): boolean; | ||
setupRpcChannel<T, U>(handler: (msg: T | undefined, rawMessage?: ConsumeMessage, headers?: any) => Promise<RpcResponse<U>>, rpcOptions: MessageHandlerOptions, channel: ConfirmChannel): Promise<ConsumerTag>; | ||
publish<T = any>(exchange: string, routingKey: string, message: T, options?: Options.Publish): void; | ||
publish<T = any>(exchange: string, routingKey: string, message: T, options?: Options.Publish): Promise<Replies.Empty>; | ||
private handleMessage; | ||
@@ -67,0 +68,0 @@ private setupQueue; |
@@ -158,3 +158,3 @@ "use strict"; | ||
const response$ = this.messageSubject.pipe((0, operators_1.filter)((x) => x.correlationId === correlationId), (0, operators_1.map)((x) => x.message), (0, operators_1.first)()); | ||
this.publish(requestOptions.exchange, requestOptions.routingKey, payload, { | ||
await this.publish(requestOptions.exchange, requestOptions.routingKey, payload, { | ||
replyTo: DIRECT_REPLY_QUEUE, | ||
@@ -300,3 +300,12 @@ correlationId, | ||
} | ||
this._channel.publish(exchange, routingKey, buffer, options); | ||
return new Promise((resolve, reject) => { | ||
this._channel.publish(exchange, routingKey, buffer, options, (err, ok) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(ok); | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -303,0 +312,0 @@ handleMessage(handler, msg, allowNonJsonMessages) { |
{ | ||
"name": "@golevelup/nestjs-rabbitmq", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Badass RabbitMQ addons for NestJS", | ||
@@ -64,3 +64,3 @@ "author": "Jesse Carter <jesse.r.carter@gmail.com>", | ||
}, | ||
"gitHead": "dd634bec5e7094b518ea9c191ea6c908db530553" | ||
"gitHead": "e54861b7414d155162676df135e7ae93d377e9f9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134744
1105