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

routing key mismatch when using custom setup function #7

Open
skif48 opened this issue May 2, 2019 · 5 comments
Open

routing key mismatch when using custom setup function #7

skif48 opened this issue May 2, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@skif48
Copy link
Owner

skif48 commented May 2, 2019

origin issue #3
@marcio199226 comment:

I have used a custom setup function

  consumerFactory.setCustomSetupFunction(async (connection) => {
    const channel = await connection.createChannel();
    await channel.assertExchange('exchange', 'topic', { durable: true });
    const queueMetadata = await channel.assertQueue('input', {
      durable: true,
      maxPriority: 10
    });

    await channel.bindQueue(queueMetadata.queue, 'exchange', 'account.*');
    await channel.prefetch(1);

    return {channel, prefetch: 1, autoAck: false, queue: 'input'};
  });

And after consuming some message, message.fields.routingKey returns my queue name "input" insteaf of currently messgae routingKey

I have used 0.1.2v

Best regards

@skif48
Copy link
Owner Author

skif48 commented May 2, 2019

@marcio199226, could you please provide a snippet on how you publish messages too?

@marcio199226
Copy link

    await publisher.publishMessage(
      Buffer.from(JSON.stringify(payload)),
      routingKey,
      {
        persistent: true,
        headers: {
          'x-created-at': moment(new Date()).format('DD/MM/YYYY HH:mm:ss')
        }
      }
    );

Where routingKey may be optional

@skif48
Copy link
Owner Author

skif48 commented May 2, 2019

Hey, @marcio199226. By optional routingKey you mean empty string?

@skif48
Copy link
Owner Author

skif48 commented May 2, 2019

I just tested your custom setup functions locally and it worked just fine. I managed to receive all the messages I've published, and the routing key contained account. part. How do you set up your publisher instance?

@marcio199226
Copy link

Hey, @marcio199226. By optional routingKey you mean empty string?

I mean it could be null or a string

I just tested your custom setup functions locally and it worked just fine. I managed to receive all the messages I've published, and the routing key contained account. part. How do you set up your publisher instance?

My publisher is an php application, so when i'm consuming messages i have this issue (i'm sure that messages which nodejs consumes has routing key)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants