# aliyun-amqp-node-cli

> aliyun amqp node cli

Latest version **1.0.0** (published 2019-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install aliyun-amqp-node-cli
pnpm add aliyun-amqp-node-cli
yarn add aliyun-amqp-node-cli
bun add aliyun-amqp-node-cli
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-02-20 |
| First published | 2019-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | zhichen |
| Maintainers | zhichen.lc |
| Keywords | amqp, RabbitMQ, node, cli, plugin, aliyun, aliware, mq |

## Links

- npm: https://www.npmjs.com/package/aliyun-amqp-node-cli
- Repository: https://github.com/jameslcj/aliyun-amqp-node-cli
- Homepage: https://github.com/jameslcj/aliyun-amqp-node-cli#readme
- Issues: https://github.com/jameslcj/aliyun-amqp-node-cli/issues
- npm.io page: https://npm.io/package/aliyun-amqp-node-cli

## Dependencies (2)

- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.9-1
- [js-base64](https://npm.io/package/js-base64.md) ^2.5.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-02-20

## README

# 阿里云 amqp node 客户端版本

## 安装

> 安装 aliyun-amqp-node-cli依赖
```bash
npm install aliyun-amqp-node-cli  --save
```

> 如果没有安装 amqplib 请执行如下命令安装
```bash
npm install amqplib --save
```

## 使用方法
```js
const aliyunAmqpCli = require('aliyun-amqp-node-cli');

// 阿里云账户配置信息
const config = {
    accessKeyId: '${accessKeyId}',
    accessKeySecret: '${accessKeySecret}',
    resourceOwnerId: '${resourceOwnerId}',
};

// 将配置传递 获取新连接对象
const amqplib = aliyunAmqpCli(config)(require('amqplib'));

// 连接amqp服务器
const open = amqplib.connect('amqp://${endPointer}/${vhost}', {
  timeout: 300 * 1000,
});

const q = 'taks';

// Publisher
open
  .then(conn => {
    return conn.createChannel();
  })
  .then(ch => {
    return ch.assertQueue(q).then(function(ok) {
      return ch.sendToQueue(q, Buffer.from('something to do'));
    });
  })
  .catch(console.warn);


// Consumer
open
  .then(function(conn) {
    return conn.createChannel();
  })
  .then(function(ch) {
    return ch.assertQueue(q).then(function(ok) {
      return ch.consume(q, function(msg) {
        if (msg !== null) {
          console.log(msg.content.toString());
          ch.ack(msg);
        }
      });
    });
  })
  .catch(console.warn);

```

## Api 使用
[请参考 amqplib 文档](http://www.squaremobius.net/amqp.node/channel_api.html)

[amqplib 项目地址](https://github.com/squaremo/amqp.node)

---
_Source: https://npm.io/package/aliyun-amqp-node-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
