简体   繁体   English

骆驼AWS SNS异常

[英]Camel AWS SNS Exceptions

I am trying to send an SNS using Apache camel by using the camel sns library. 我正在尝试通过使用骆驼sns库使用Apache骆驼发送SNS。

I used the documentation found here http://camel.apache.org/aws-sns.html 我使用了http://camel.apache.org/aws-sns.html上找到的文档

Where it says I need to define a client and then bind it to the registry. 它说我需要定义一个客户端,然后将其绑定到注册表。 Therefore I have done this using this code: 因此,我使用以下代码完成了此操作:

BasicAWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3 client = AmazonS3Client.builder().withRegion("eu-west-1")
                        .withCredentials(new AWSStaticCredentialsProvider(creds))
                        .build();

CamelContext context = new DefaultCamelContext();
            JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry)context.getRegistry()).getRegistry();
            registry.bind("client", client);

Following this, inside my camel route, I am carrying out this operation 之后,在我的骆驼路线内,我正在执行此操作

from(mySftp.getUri("/camel"))
to("aws-sns://"+topicArn+"?amazonSNSClient=#client")

With this code, I get this error - 有了这段代码,我得到这个错误-

Failed to create route route1 at: >>> To[aws-sns://arn:aws:sns:eu-west-1:xxxxxx?amazonSNSClient=#client] <<< in route: Route(route1)[[From[sftp://xxxxxxxx... because of Failed to resolve endpoint: aws-sns://arn:aws:sns:eu-west-1:xxxxxxxx?amazonSNSClient=%23client due to: Could not find a suitable setter for property: amazonSNSClient as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: com.amazonaws.services.sns.AmazonSNS with value #client 无法在以下位置创建路由route1:>>> To [aws-sns:// arn:aws:sns:eu-west-1:xxxxxx?amazonSNSClient =#client] <<<在路由中:Route(route1)[[从[sftp:// xxxxxxxx ...,因为无法解析端点:aws-sns:// arn:aws:sns:eu-west-1:xxxxxxxx?amazonSNSClient =%23client由于:无法找到合适的设置器属性:amazonSNSClient,因为没有相同类型的setter方法:java.lang.String,也无法进行类型转换:没有类型转换器可用于从类型:java.lang.String转换为所需类型:com.amazonaws.services。具有值#client的sns.AmazonSNS

Apart from this, I have also tried to send an sns using the following camel route 除此之外,我还尝试过使用以下骆驼路线发送短信

.to("aws-sns://"+topicArn+"?accessKey="+accessKey+"&secretKey="+secretKey+"&amazonSNSEndpoint="+snsEndpoint)

but then it tells me no region is provided although my snsEnpoint is set to - sns.eu-west-1.amazonaws.com 但是它告诉我没有提供任何区域,尽管我的snsEnpoint设置为sns.eu-west-1.amazonaws.com

Anyone has an idea why I cannot send an sns using camel in anyway way which i try? 任何人都知道为什么我无论如何都无法使用骆驼发送sns?

Thanks in advance 提前致谢

You are binding an AmazonS3Client , but it needs an AmazonSNSClient . 您正在绑定AmazonS3Client ,但它需要一个AmazonSNSClient

Camel cannot convert the reference to a an AmazonS3Client to an instance of AmazonSNSClient . 骆驼不能引用转换成一个AmazonS3Client到的实例AmazonSNSClient

See http://camel.apache.org/aws-sns.html#AWS-SNS-AdvancedAmazonSNSconfiguration 请参阅http://camel.apache.org/aws-sns.html#AWS-SNS-AdvancedAmazonSNS配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM