I’m pretty new to Spring configuration and Camel. I’ve started with an example 
from the Camel tarball and modified it to use the “awd-sns” URI. Specifying all 
parameters on the the URI I can successfully create and post to an SNS topic.

I would like to store the AWS credentials and endpoint in the 
ApplicationContextRegistry at run-time and reference the configuration via 
amazonSNSClient# in the “aws-sns” URI as described here 
http://camel.apache.org/aws-sns.html <http://camel.apache.org/aws-sns.html>. 
The provided example:

AWSCredentials awsCredentials = new BasicAWSCredentials("myAccessKey", 
"mySecretKey");
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost("http://myProxyHost";);
clientConfiguration.setProxyPort(8080);
AmazonSNS client = new AmazonSNSClient(awsCredentials, clientConfiguration);
 
registry.bind("client", client);

Uses the bind method to store the client details in the registry, from what I 
can work out the bind method is only applicable JndiRegistry not 
ApplicationContextRegistry.

My spring/camel-context.xml file is pretty basic and looks like this:

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:context="http://www.springframework.org/schema/context";
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd";>

  <!-- first, define your individual @Configuration classes as beans -->
  <bean class="org.apache.camel.example.spring.javaconfig.MyRouteConfig"/>

  <!-- be sure the configure class to be processed -->
  <context:annotation-config/>

</beans>

Where could I find pointers to the pieces needed to configure Spring so that I 
can create and modify the clientConfiguration at run-time?

Thanks.

Cheers, Shane

Reply via email to