【发布时间】:2015-01-31 11:12:13
【问题描述】:
有人知道如何在 java 中使用 Camel DSL 接收 SQS 消息属性吗? 我收到以下错误:
“无法创建路由收款人路由:路由(批量路由)[[From[aws-sqs://myqueue?amazonSQSEndpoint=...因为无法解析端点:aws-sqs://myqueue?amazonSQSEndpoint= sqs.us-west-1.amazonaws.com&accessKey=*****&secretKey=******************&maxMessagesPerPoll=1&messageAttributeNames=%5BuserID%5 由于:找不到适合属性的设置器:messageAttributeNames,因为没有相同类型的设置器方法:java.lang.String 也没有类型转换:没有类型转换器可用于从类型:java.lang.String 转换为所需类型:java.util .Collection 值为 [userID] "
请找到我的代码
StringBuilder QueueURI = new StringBuilder();
QueueURI(PropertyUtils.AWS_SQS)
.append(propertyUtils.queueName)
.append(PropertyUtils.AMAZON_SQS_REGION)
.append(propertyUtils.sqsRegion);
QueueURI(PropertyUtils.AWS_ACCESS_KEY).append(
propertyUtils.awsAccessKey);
QueueURI(PropertyUtils.AWS_SECRET_KEY).append(
propertyUtils.awsSecretKey);
QueueURI(PropertyUtils.MAX_MESSAGES_PER_POLL_1);
QueueURI("&messageAttributeNames=");
Collection<String> collection = new ArrayList<String>();
collection.add("userID");
//aws-sqs://myqueue?amazonSQSEndpoint=sqs.us-west-1.amazonaws.com&accessKey=*****&secretKey=****************&maxMessagesPerPoll=1&messageAttributeNames=[userID]
from(QueueURI.ToString() + collection)
.routeId("batch route")
.process(userValidator);
【问题讨论】:
标签: java amazon-web-services apache-camel amazon-sqs