I'm sure this isn't your issue but I ran into a similar thing where I thought 
the CamelHttpResponseCode was not being set. It turned out that when returning 
from the processing from my web svc call Camel would ignore what I set in this 
header and would set it to 200.  Like I said it appeared that things weren't 
being set but upon stepping through the code it turned out I was setting it and 
then Camel was setting a default after. What resolved my issue was that after 
my call returned (and Camel had done it's serialization, etc) I had to copy the 
response code (the javax.ws.rs.core.Response.getStatus() was still set properly 
on the response) back into the CamelHttpResponseCode header.  Probably not your 
issue but double check and see if Camel isn't defaulting the  
CamelAwsSqsMessageAttributes header somewhere in the processing pipeline. Hope 
you get it resolved.

Thanks,

Matt

-----Original Message-----
From: scurtis-engineer [mailto:curtisse...@gmail.com]
Sent: Friday, September 25, 2015 2:54 PM
To: users@camel.apache.org
Subject: CamelAwsSqsMessageAttributes header not appearing on messages in AWS 
SQS Queue - Camel 2.15.2

I have read seemingly every SO question response, and posted my own question 
there that no one has answered up to this point, and I am about to tear my hair 
out in frustration! :)

Using Camel Blueprint, v. 2.15.2, I have a route defined in the XML in which I 
am attempting to set the CamelAwsSqsMessageAttributes header in order to pass 
along some message metadata to an SQS queue on the other end. This is running 
on a Servicemix v. 5.3.0 box. Here are a couple of code snippets:



Note: in the errorAttributeList, I have tried all kinds of values because it 
wasn't clear exactly what I should I be putting there. I have put "All, 
CustomErrorWhatnot, *",etc.

Here's the ErrorProcessor bean process method:

public void process(Exchange exchange) throws Exception {
        this.setSQSClient(exchange);

        //reset the body
        String originalBody = exchange.getProperty("originalBodyFromQueue",
String.class);
        //get the error
        String errorProp = exchange.getProperty("errorMessage",
String.class);

        exchange.getIn().setBody(originalBody);

        LOGGER.info("processing error for message with body: {}, and error:
{}", exchange.getIn().getBody(), errorProp);

        Map<String, String> msgAttrs = new HashMap<>();
        msgAttrs.put("SomeError", errorProp.replaceAll(":"," "));

        exchange.getIn().setHeader("CamelAwsSqsMessageAttributes",
msgAttrs);
}


The logging messages verify that the error message is there, the header is set 
appropriately in the route once the process method has completed, and it exists 
on that end. But when I view the message in the AWS console, the only header I 
see is breadcrumbId, like so:

<http://camel.465427.n5.nabble.com/file/n5771992/MessageInTheConsole.png>

Am I doing something wrong in the URI/setup in the route? Are the headers lost 
outside of the context in which they are set? I have seen other posts that 
indicate that's the case with *CUSTOM* message properties and headers, but it 
seems that Camel headers should persist. Please help before all my hair is gone!



--
View this message in context: 
http://camel.465427.n5.nabble.com/CamelAwsSqsMessageAttributes-header-not-appearing-on-messages-in-AWS-SQS-Queue-Camel-2-15-2-tp5771992.html
Sent from the Camel - Users mailing list archive at Nabble.com.

________________________________

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.

Reply via email to