[英]how to retrieve aws sqs message attribute in camel DSL java?
I have sent the message attribute to AWS sqs along with body using Apache camel below command我已使用 Apache camel 下面的命令将消息属性与正文一起发送到 AWS sqs
to("aws-sqs://{{queue.name}}?amazonSQSClient=#sqsClient&attributeNames=#systemName")
Message sent successfully.消息已成功发送。 Now i want to retrieve the the message attribute systemName using Camel DSL java.现在我想使用 Camel DSL java 检索消息属性systemName 。 But not able to retrieve it.但无法找回。 CamelAwsSqsAttributes and CamelAwsSqsMessageAttributes both are coming blank in the header. CamelAwsSqsAttributes和CamelAwsSqsMessageAttributes在 header 中都将变为空白。 Below are the code of Consumer下面是消费者的代码
Main main = new Main();
main.bind("sqsAttributeNames", Collections.singletonList("All"));
main.bind("sqsMessageAttributeNames", Collections.singletonList("All"));
from("aws-sqs://a{{queue.name}}?" +
"amazonSQSClient=#sqsClient&attributeNames=#sqsAttributeNames&messageAttributeNames=#sqsMessageAttributeNames")
.log("We have a failed request message in queue ${headers}")
Can someone please help me on this??有人可以帮我吗?
The config looks okay, except the Collection should be replaced by comma-separated Strings (make sure there are no space between the Strings).配置看起来不错,除了 Collection 应替换为逗号分隔的字符串(确保字符串之间没有空格)。
Also, please mention the attributes that you want.另外,请提及您想要的属性。 All may not work.一切可能都行不通。
Main main = new Main();
main.bind("sqsAttributeNames", "Attr1,Attr2");
main.bind("sqsMessageAttributeNames", "Attr1,Attr2");
Please follow latest Camel-SQS-Component.请关注最新的 Camel-SQS-Component。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.