Thank you for your reply Claus. As I said in my post I'm quite new to Spring and Camel and yes there are a lot of pages on the Internet about Spring, all quite a opaque to a new comer.
I want to be able to configure the amazonSNSClient at run time, if I follow your example I would be configuring the client at packaging time, which isn't what I want to do. It would be helpful, not only to me, but I'm sure to others, to offer a snippet that gave some indication of the key camelContext pieces that would need to be set to create the client and set the AWS credentials. Cheers, Shane > On 27 Jan 2015, at 6:04 pm, Claus Ibsen <[email protected]> wrote: > > 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/
