@azure/core-amqp

中文文档
4.5.1发布于 2026/09/04MITTypeScriptESM + CJS近 30 天下载 396.4万

Common library for amqp based azure sdks like @azure/event-hubs.

原始使用文档
文档目录8 节
  1. Getting started
  2. Installation
  3. Currently supported environments
  4. Key concepts
  5. Next steps
  6. Troubleshooting
  7. Logging
  8. Contributing

Azure Core AMQP client library for JavaScript

The @azure/core-amqp package provides common functionality for Azure JavaScript libraries that use the AMQP protocol like the ones for Azure Service Bus and Azure Event Hubs.

Getting started

Installation

Install this library using npm as follows:

npm install @azure/core-amqp

Currently supported environments

See our support policy for more details.

Key concepts

Some of the key features of Azure Core AMQP library are:

Next steps

You can build and run the tests locally by executing npm run test. Explore the test folder to see advanced usage and behavior of the public classes.

Troubleshooting

The core-amqp library depends on the rhea-promise library for managing connections, and for sending and receiving events over the AMQP protocol.

Logging

You can set the AZURE_LOG_LEVEL environment variable to one of the following values to enable logging to stderr:

  • verbose
  • info
  • warning
  • error

You can also set the log level programmatically by importing the @azure/logger package and calling the setLogLevel function with one of the log level values. For example, when you set the log level to info, the logs that are written for levels warning and error are also emitted. This SDK follows the Azure SDK for TypeScript guidelines when determining which level to log to.

When setting a log level either programmatically or via the AZURE_LOG_LEVEL environment variable, any logs that are written using a log level equal to or less than the one you choose will be emitted.

You can alternatively set the DEBUG environment variable to get logs when using this library. This can be useful if you also want to emit logs from the dependencies rhea-promise and rhea as well.

Note: AZURE_LOG_LEVEL, if set, takes precedence over DEBUG. Do not specify any azure libraries via DEBUG when also specifying AZURE_LOG_LEVEL or calling setLogLevel.

  • Getting only info level debug logs from the core-amqp library.
export DEBUG=azure:core-amqp:info
  • Getting debug logs from the core-amqp and the protocol level library.
export DEBUG=azure:core-amqp:*,rhea*
  • If you are not interested in viewing the raw event data (which consumes a large amount of console/disk space) then you can set the DEBUG environment variable as follows:
export DEBUG=azure:core-amqp:*,rhea*,-rhea:raw,-rhea:message
  • If you are interested only in errors and SDK warnings, then you can set the DEBUG environment variable as follows:
export DEBUG=azure:core-amqp:(error|warning),rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow

Logging to a file

  • Set the DEBUG environment variable as shown above and then run your test script as follows:
    • Logging statements from you test script go to out.log and logging statement from the sdk go to debug.log.
      node your-test-script.js > out.log 2>debug.log
      
    • Logging statements from your test script and the sdk go to the same file out.log by redirecting stderr to stdout (&1), and then redirect stdout to a file:
      node your-test-script.js >out.log 2>&1
      
    • Logging statements from your test script and the sdk go to the same file out.log.
      node your-test-script.js &> out.log
      

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

版本与发布记录

@azure/core-amqp 共发布 606 个版本,首次发布于 2019/06/29;过去 12 个月发布了 58 个版本。

版本发布日期距今
4.5.1latest2026/09/042 个月前
4.5.02026/07/143 个月前
4.4.22026/04/236 个月前
4.4.2-alpha.20260311.2dev2026/03/127 个月前
4.4.2-alpha.20260306.42026/03/078 个月前
4.4.2-alpha.20260305.62026/03/068 个月前

其他发布通道:next → 4.4.0-beta.1,dev → 4.4.2-alpha.20260311.2。

关于 @azure/core-amqp 的常见问题

@azure/core-amqp 是什么?

Common library for amqp based azure sdks like @azure/event-hubs.

如何安装 @azure/core-amqp?

在项目目录运行 npm install @azure/core-amqp,或使用 pnpm add / yarn add / bun add。

@azure/core-amqp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@azure/core-amqp 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@azure/core-amqp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@azure/core-amqp 可以商用吗?

@azure/core-amqp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azure/core-amqp 的下载量有多少?

根据 npm 官方下载统计,@azure/core-amqp 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,963,575 次,日均约 132,119 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azure/core-amqp 还在维护吗?

最新版本 4.5.1 发布于 2026/09/04(2 个月前);至今共发布 606 个版本,其中过去 12 个月发布了 58 个;首次发布于 2019/06/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。