【问题标题】:Where are AWS SQS message built-in message attributes documented?AWS SQS 消息内置消息属性记录在哪里?
【发布时间】:2020-05-01 15:39:48
【问题描述】:

我正在使用 Node.js 开发工具包向 AWS SQS 发送消息。我找不到列出可以在消息中指定的各种内置属性的文档。文档中的示例指定了一个名为“DelaySeconds”的属性,但我看不到任何地方记录了该属性?

大概是指示 SDK 在发送消息之前等待 n 秒?我正在尝试获取允许在消息中指定的属性的完整列表。注意:我不是指可以指定我自己的消息属性的 MessageAttributes,我指的是 AWS 查看的属性,例如 MessageBody、QueueURL、DelaySeconds 等。

这是我正在查看的文档的链接: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/sqs-examples-send-receive-messages.html

这里有完整的示例代码:

// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region 
AWS.config.update({region: 'REGION'});

// Create an SQS service object
var sqs = new AWS.SQS({apiVersion: '2012-11-05'});

var params = {
  DelaySeconds: 10,     <--- where is this documented?
  MessageAttributes: {
    "Title": {
      DataType: "String",
      StringValue: "The Whistler"
    },
    "Author": {
      DataType: "String",
      StringValue: "John Grisham"
    },
    "WeeksOn": {
      DataType: "Number",
      StringValue: "6"
    }
  },
  MessageBody: "Information about current NY Times fiction bestseller for week of 12/11/2016.",
  // MessageDeduplicationId: "TheWhistler",  // Required for FIFO queues
  // MessageId: "Group1",  // Required for FIFO queues
  QueueUrl: "SQS_QUEUE_URL"
};

sqs.sendMessage(params, function(err, data) {
  if (err) {
    console.log("Error", err);
  } else {
    console.log("Success", data.MessageId);
  }
});

【问题讨论】:

标签: node.js amazon-web-services amazon-sqs


【解决方案1】:

我在这里找到了文档,是从页面链接的,只是没看到。 https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#sendMessage-property

【讨论】:

    猜你喜欢
    • 2014-11-10
    • 1970-01-01
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 2019-03-23
    相关资源
    最近更新 更多