我已经编写了以下API来接收消息:
app.get('/receive', function(req, res) {
var params = {
QueueUrl: queueUrl,
VisibilityTimeout: 600
};
sqs.receiveMessage(params, function(err, data) {
if (err) {
res.send(err);
} else {
console.log('data is ' + JSON.stringify(data));
res.send(data);
}
});
});
我得到的回应如下:
{
"ResponseMetadata": {
"RequestId": "id"
},
"Messages": [
{
"MessageId": "id",
"ReceiptHandle": "handle",
"MD5OfBody": "body",
"Body": "body"
}
]
}
。
API的发送消息格式如下所示:
let params = {
MessageBody: object,
QueueUrl: process.env.queueUrl,
MessageAttributes:{
"Title":{
DataType:'String',
StringValue:'Item Id Array',
}
},
DelaySeconds: 0
}
sqs.send(params, (err, data) => {
console.log('------------the send message data is------------',err,data);
});
答案 0 :(得分:2)
您必须告诉SQS您希望在传递给params
函数的参数中接收哪些属性。
因此,在/receive
路由中,var params = {
QueueUrl: queueUrl,
VisibilityTimeout: 600,
MessageAttributeNames: ["All"],
};
路由中的func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let storyboard = UIStoryboard(name: "YourStoryBoardName", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "pdfDisplayViewController") as! pdfDisplayViewController
self.navigationController?.pushViewController(controller, animated: false)
self.navigationController?.navigationBar.isHidden = true
}
定义可能如下所示:
this.person = this.formBuilder.group({
name:[],
age:[]
customAttributes: this.formBuilder.group({
}
有关详细信息,请查看以下链接: