Camel AWS SNS - 参数无效:TopicArn

时间:2017-06-27 10:30:50

标签: amazon-web-services apache-camel

我正在尝试使用AWS Camel向AWS SNS主题发送消息。 我已按如下方式定义了SNS客户端:

<bean name="snsClient" class="com.amazonaws.services.sns.AmazonSNSClient">
    <constructor-arg>
        <bean class="com.amazonaws.auth.BasicAWSCredentials">
            <constructor-arg value="${access.key}"/>
            <constructor-arg value="${secret.key}"/>
        </bean>
    </constructor-arg>
</bean>

以下的Camel路线:

<route id="content.publication.receipting.CPS">
...
  <to id="DeliverBundleToPIPS" uri="aws-sns://arn:aws:sns:<MyRegion>:<MyAccount>:<MySNSTopicArn>?amazonSNSClient=#snsClient"></to>
</route>

它失败并显示以下消息:

WARN  Exchange failed, so rolling back message status: Exchange[ID-U6023035-TPL-A-64492-1498559205318-0-2]
com.amazonaws.services.sns.model.InvalidParameterException: Invalid parameter: TopicArn (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 7a352f55-22f0-59c4-9c68-7e9917bdec0f)

,并且是正确的值。

1 个答案:

答案 0 :(得分:0)

经过一些研究和测试后,我明确指定了amazonSNSEndpoint:

<route id="content.publication.receipting.CPS">
...
  <to id="DeliverBundleToPIPS" uri="aws-sns://arn:aws:sns:<MyRegion>:<MyAccount>:<MySNSTopicArn>?amazonSNSClient=#snsClient&amp;amazonSNSEndpoint=sns.us-west-2.amazonaws.com"></to>
</route>

在这种情况下,默认的区域选择机制似乎无法正常工作。