Skip to content

Commit

Permalink
feat(rabbitmq): allow setting custom message headers (#374)
Browse files Browse the repository at this point in the history
fixes #372
  • Loading branch information
underfisk authored and WonderPanda committed Jan 23, 2022
1 parent bc49fbc commit d0a2192
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/rabbitmq/src/amqp/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export class AmqpConnection {
{
replyTo: DIRECT_REPLY_QUEUE,
correlationId,
headers: requestOptions.headers,
}
);

Expand Down Expand Up @@ -384,9 +385,9 @@ export class AmqpConnection {
return;
}

const { replyTo, correlationId } = msg.properties;
const { replyTo, correlationId, headers } = msg.properties;
if (replyTo) {
await this.publish('', replyTo, response, { correlationId });
await this.publish('', replyTo, response, { correlationId, headers });
}
channel.ack(msg);
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions packages/rabbitmq/src/rabbitmq.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface RequestOptions {
correlationId?: string;
timeout?: number;
payload?: any;
headers?: any;
}

export interface QueueOptions {
Expand Down

0 comments on commit d0a2192

Please sign in to comment.