On Mon, Jan 19, 2009 at 12:54 PM, icucode <[email protected]> wrote:
>
> Hi,
>
> I'm trying to send attachments attached to the message that is sent to the
> queue but they seem to vanish on the way for some reason; because on the
> consumer side they no longer exist.
>
> == producer ==
> public static void sendMessageInOnly(File attachment)
> {
>   Endpoint endpoint = camel.getEndpoint(address);
>   Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
>
>   exchange.getIn().addAttachment(attachment.getName(), new DataHandler(new
> FileDataSource(attachment)));
>
>   Producer producer = endpoint.createProducer();
>   producer.start();
>   producer.process(exchange);
>   producer.stop();
> }
> Note: attachment is valid and everything seems ok on the producer side.
>
> == Consumer ==
> public void process(Exchange exchange) throws Exception
> {
>   System.out.println("Recieved message...");
>   System.out.println("Message has attachments: " +
> exchange.getIn().hasAttachments());
> }
> Note: hasAttachments() returns false.
Yeah thats a bug we have fixed in the next Camel 1.6 I think.

>
> public class ConsumerRoute extends RouteBuilder
> {
>    @Override
>    public void configure() throws Exception
>    {
>        from("jms:queue:jobs").process(new JobConsumer());
>    }
> }
>
> In the debug output from the consumer, attachments aren't even listed -
> only; Pattern, Headers, BodyType and Body. In the headers section there are
> only JMS specific properties. How can I fetch the attachments if
> getAttachments() isn't the right way?
Attachements to my knowledge hasn't been used much and I could suspect
some transports types / components dont support them.
It was added to Camel as its used in JBI. But pure Camel routing
doesnt really use it.
Its definitely not (yet) supported over JMS with Camel.

You should store it in the body instead.

>
>
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/Missing-attachments-tp21541575s22882p21541575.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Reply via email to