I am trying to send an SNS using Apache camel by using the camel sns library.
I used the documentation found here 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
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
Anyone has an idea why I cannot send an sns using camel in anyway way which i try?
Thanks in advance
from(mySftp.getUri("/camel")) .to("aws-sns://"+topicArn+"?.to("aws-sns://"+topicArn+"?amazonSNSClient=#client")
I see 2.to
invocations, but the 1st one has no right bracket – Davide Cavestro