Hi

You can define beans in spring xml file, where you can configure the
client just as the example does in java code.

<bean id="someName" class="com.foo.SomeClass">
  <property name="proxyHost" value="..."/>
   ..
</bean>

And you can refer to other beans. Its standard spring xml syntax, so
you can find plenty of documentation on the internet

On Tue, Jan 27, 2015 at 4:12 AM, Shane MacPhillamy <[email protected]> wrote:
> 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
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to