1 Reply Latest reply on Nov 11, 2009 9:40 PM by Jeff Romine

    how do i copy a NormalizedMessage with attachments without breaking it?

    Jeff Romine Newbie

      I have been trying to write a servicemix-bean component (not sure that is the right term) which:

       

      1. receives a message with an attachment sent by a file-poller component using the BinaryFileMarshaler.

      2. reads the attachment and does something based on it.

      3. copies the incoming message unaltered to the outgoing message.

       

      The problem is that reading the attachment ends up closing the input stream so that it can no longer be accessed.  I've tried making a copy of the NormalizedMessage using  MessageUtil.copy() but this has the same problem.

       

      Is there a straightforward way of doing this or do I need to write my own copy method for attachments?

       

      Thank's.