Amazon SQS Java SDK - cannot receive message attributes

♀尐吖头ヾ 提交于 2019-12-03 04:39:36

You have to specify which message attributes you want in your request (or use "All" to get all message attributes). So in your case you could use either

List<Message> messages = sqs.receiveMessage(receiveMessageRequest.withMessageAttributeNames("attributeTest")).getMessages();

or

List<Message> messages = sqs.receiveMessage(receiveMessageRequest.withMessageAttributeNames("All")).getMessages();

If you want the standard attributes (ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SenderId, and SentTimestamp) along with your messages, use withAttributeNames("All"). You can find more detail in the Javadocs for ReceiveMessageRequest.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!