Note that when I set the body exchange in MimeMultipartDataFormat.java <https://github.com/apache/camel/blob/main/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java> directly it works:
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); mm.writeTo(byteStream, headers.toArray(new String[0])); exchange.getIn().setBody(byteStream.toString()); however when using the normal stream: mm.writeTo(stream, headers.toArray(new String[0])); (on line 167) On Fri, Feb 14, 2025 at 5:02 PM ski n <raymondmees...@gmail.com> wrote: > I have the following route: > > <route> > <from uri="direct:start"/> > <enrich strategyRef="CurrentEnrichStrategy"> > <simple>direct:enrich</simple> > </enrich> > <marshal ref="mimemultipart"/> > <to uri="log:loggingmimemessage"/> > </route> > > This route works as follows: > > 1. Enrich: Adds the body from the enrich endpoint as attachment: > 2. Marshal: The exchange with attachment is marshalled to a MimeMessage > using MimeMultipartDataFormat > > This worked until 4.9.0, but from 4.10.0 I don't always get the > mimemessage. When I use an InOut exchange pattern the resulted exchange has > the right has headers, but the body is still from the original exchange. > > I can work around this by changing the route to InOnly before the enrich > step. > > <route> > <from uri="direct:start"/> > <setExchangePattern pattern="InOnly"/> > <enrich strategyRef="CurrentEnrichStrategy"> > <simple>direct:enrich</simple> > </enrich> > <marshal ref="mimemultipart"/> > <to uri="log:loggingmimemessage"/> > </route> > > The above route gives the intended output (reply). I saw in the release > notes/what's new that there are some changes with attachments, could that > be the cause? > > Raymond > > > Link to the custom AggregateStrategy: > https://github.com/assimbly/runtime/blob/develop/dil/src/main/java/org/assimbly/dil/blocks/beans/enrich/attachment/AttachmentEnrichStrategy.java > Link to used MimeMultipartDataFormat: > https://github.com/apache/camel/blob/main/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java >