骆驼 AWS SNS 异常

Camel AWS SNS Exceptions

我正在尝试通过使用 camel sns 库使用 Apache camel 发送 SNS。

我使用了此处找到的文档 http://camel.apache.org/aws-sns.html

它说我需要定义一个客户端,然后将它绑定到注册表。因此,我使用以下代码完成了此操作:

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);

接下来,在我的骆驼路线中,我正在执行此操作

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

使用这段代码,我得到了这个错误 -

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

除此之外,我还尝试使用以下骆驼路线发送 sns

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

但是它告诉我没有提供区域,尽管我的 snsEnpoint 设置为 - sns.eu-west-1.amazonaws.com

任何人都知道为什么我无法以我尝试的任何方式使用 camel 发送 sns?

提前致谢

您正在绑定一个 AmazonS3Client,但它需要一个 AmazonSNSClient

Camel 无法将对 AmazonS3Client 的引用转换为 AmazonSNSClient.

的实例

http://camel.apache.org/aws-sns.html#AWS-SNS-AdvancedAmazonSNSconfiguration