AWS SNS + Camel + "amazonSNSEndpoint" being ignored?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

AWS SNS + Camel + "amazonSNSEndpoint" being ignored?

cdfleischmann
This post was updated on .
Hello folks, wondering if you have come across this issue, or if there is something simple I am doing wrong.

I am using the SNS Camel component, declared as:

<bean name="snsClient" class="com.amazonaws.services.sns.AmazonSNSClient">
        <constructor-arg>
            <bean class="com.amazonaws.auth.BasicAWSCredentials">
                <constructor-arg value="${access.key}"/>
                <constructor-arg value="${secret.key}"/>
            </bean>
        </constructor-arg>
    </bean>


And in my routebuilder, I have created the following route like so;

Exchange exchange2 = producer.send("aws-sns://Topic?amazonSNSClient=#snsClient",
            new Processor() {
                public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is my subject");
                    exchange.getIn().setBody("This is my message text.");
                }
            });
           
            // Simply print out the message id.
            System.out.println("Message ID: " + exchange2.getIn().getHeader(SnsConstants.MESSAGE_ID));


Which works fine, I can subscribe to the topic and receive my notifications, however, when I try to add the amazonSNSEndpoint=ap-southeast-2 parameter to change to the Sydney region, it seems to be ignored?

Exchange exchange2 = producer.send("aws-sns://Topic?amazonSNSClient=#snsClient&amazonSNSEndpoint=ap-southeast-2"


Instead, I am doing the following to work-around this issue, prior to calling my producer.send command...

snsClient = (AmazonSNSClient) exchange.getContext().getRegistry().lookup("snsClient");
snsClient.setEndpoint("http://sns.ap-southeast-2.amazonaws.com/");


Out of interest, I have also tried:


Exchange exchange2 = producer.send("aws-sns://Topic?amazonSNSClient=#snsClient&amazonSNSEndpoint=sns.ap-southeast-2.amazonaws.com"


... to no avail. Is there something I am missing with respect to this value/parameter?

Lastly, I believe I am using 2.13-snapshot for my camel pom.xml file.

Please do let me know... Cheers,
Chris
Reply | Threaded
Open this post in threaded view
|

Re: AWS SNS + Camel + "amazonSNSEndpoint" being ignored?

Willem.Jiang
Administrator
Hi

I just checked the code and found camel ignores the “amazonSNSEndpoint” option.
So I filled a JIRA[1] and the patch is on the way :)

[1]https://issues.apache.org/jira/browse/CAMEL-7286

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 12, 2014 at 8:08:41 AM, cdfleischmann ([hidden email]) wrote:

> Hello folks, wondering if you have come across this issue, or if there is
> something simple I am doing wrong.
>  
> I am using the SNS Camel component, declared as:
>  
> /*  
>  
>  
>  
>  
>  
>  
> */
>  
> And in my routebuilder, I have created the following route like so;
>  
> */Exchange exchange2 =
> producer.send("aws-sns://TabcorpTopic?amazonSNSClient=#snsClient",
> new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is
> my subject");
> exchange.getIn().setBody("This is my message text.");
> }
> });
>  
> // Simply print out the message id.
> System.out.println("Message ID: " +
> exchange2.getIn().getHeader(SnsConstants.MESSAGE_ID));/*
>  
> Which works fine, I can subscribe to the topic and receive my notifications,
> however, when I try to add the amazonSNSEndpoint=ap-southeast-2 parameter to
> change to the Sydney region, it seems to be ignored?
> /
> *Exchange exchange2 =
> producer.send("aws-sns://TabcorpTopic?amazonSNSClient=#snsClient&amazonSNSEndpoint=ap-southeast-2"*/  
>  
> Instead, I am doing the following to work-around this issue, prior to
> calling my producer.send command...
>  
> /*snsClient = (AmazonSNSClient)
> exchange.getContext().getRegistry().lookup("snsClient");
> snsClient.setEndpoint("http://sns.ap-southeast-2.amazonaws.com/"); */
>  
> Out of interest, I have also tried:
>  
> /
> *Exchange exchange2 =
> producer.send("aws-sns://TabcorpTopic?amazonSNSClient=#snsClient&amazonSNSEndpoint=sns.ap-southeast-2.amazonaws.com"*/  
>  
> ... to no avail. Is there something I am missing with respect to this
> value/parameter?
>  
> Lastly, I believe I am using 2.13-snapshot for my camel pom.xml file.
>  
> Please do let me know... Cheers,
> Chris
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/AWS-SNS-Camel-amazonSNSEndpoint-being-ignored-tp5748651.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply | Threaded
Open this post in threaded view
|

Re: AWS SNS + Camel + "amazonSNSEndpoint" being ignored?

cdfleischmann
Thanks Willem, will look forward to the fix then :)

Reply | Threaded
Open this post in threaded view
|

Re: AWS SNS + Camel + "amazonSNSEndpoint" being ignored?

Willem.Jiang
Administrator
It’s done.
You can find the patch from the JIRA I showed you earlier.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 12, 2014 at 11:18:32 AM, cdfleischmann ([hidden email]) wrote:

> Thanks Willem, will look forward to the fix then :)
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/AWS-SNS-Camel-amazonSNSEndpoint-being-ignored-tp5748651p5748660.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>