Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make replying to a message with the replyTo field set optional #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/amqp-ts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/amqp-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,8 @@ export class Queue {
var result = this._consumer(payload);
// convert the result to a promise if it isn't one already
Promise.resolve(result).then((resultValue) => {
// check if there is a reply-to
if (msg.properties.replyTo) {
// check if there is a reply-to and that the result from the consumer is not null or undefined
if (msg.properties.replyTo && resultValue != null) {
var options: any = {};
resultValue = Queue._packMessageContent(resultValue, options);
this._channel.sendToQueue(msg.properties.replyTo, resultValue, options);
Expand Down Expand Up @@ -980,8 +980,8 @@ export class Queue {
var result = this._consumer(message);
// convert the result to a promise if it isn't one already
Promise.resolve(result).then((resultValue) => {
// check if there is a reply-to
if (msg.properties.replyTo) {
// check if there is a reply-to and that the result from the consumer is not null or undefined
if (msg.properties.replyTo && resultValue != null) {
if (!(resultValue instanceof Message)) {
resultValue = new Message(resultValue, {});
}
Expand Down