0.1.3 • Published 7 months ago

@got-api/ons v0.1.3

Weekly downloads
6
License
MIT
Repository
-
Last release
7 months ago

api-ons

https://help.aliyun.com/document_detail/102996.html

TODO

  • 请求重试

sample

const Ons = require('.')

const {
  TEST_ALIYUN_KEY,
  TEST_ALIYUN_SECRET,
  TEST_ONS_ENDPOINT,
  TEST_ONS_INSTANCE_ID
} = process.env

const ons = new Ons({
  endpoint: TEST_ONS_ENDPOINT,
  accessKeyId: TEST_ALIYUN_KEY,
  accessKeySecret: TEST_ALIYUN_SECRET
})

const baseQuery = ons
  .query()
  .instanceId(TEST_ONS_INSTANCE_ID)
  .topic('ADM_TIMER')
  .tag('test_dev_1')
  .consumer('GID_ADM_TIMER_test_dev_hc')

const start = async () => {
  const { MessageId } = await baseQuery.create('test')
  let hasMore = true
  do {
    const msgs = await baseQuery.find(1)
    while (msgs.length) {
      const msg = msgs.pop()
      if (msg.MessageId === MessageId) {
        hasMore = false
      }
      await baseQuery.delete(msg.ReceiptHandle)
    }
  } while (hasMore)
}

start()
0.1.2

10 months ago

0.1.3

7 months ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.8

2 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago