• /
  • Log in
  • Free account

Troubleshoot message consumers

Problem

Message consumer services have a few differences to HTTP servers that make monitoring them more difficult. This document discusses those limitations and ways to work around them with the New Relic Node.js agent.

Because a message does not necessarily have a reply, it can be hard to determine the end of a transaction. If New Relic's Node.js agent cannot determine when a message consumer will be done, it will immediately end the transaction. Follow these troubleshooting tips depending on your application.

Solution

The solution to this issue depends on whether you are using callbacks or promises:

Callbacks

When using a callback-based messaging API such as amqplib's callback_api, there is no easy way to determine when your consumer is done. Here is an example.

Promises

For promise-based servers, the message consumer simply needs to return a promise. When that promise resolves or rejects, the transaction will be ended. Here is an example:

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.