Hi,

In one of my tests a few days back I discovered a bit of an odd thing. Camel is working as expected, but a bit weird.

So I was processing messages with attachments all went well, but discovered that we don't have an expression that returns the attachments on a messages. There is the @Attachments annotation that uses the ExpressionBuilder.attachmentsExpression, but that returns the whole map, not just the values(). Since Map.Entry<K, V> is generic you cannot use an implicit TypeConverter to V, so I had to write my own expression, not too bad.

The interesting part was that using my attachments() expression with a splitter, returning a Collection you can iterate through works, but the splitter replaces the body of the original message with one item in the Collection, leaving the attachments in place. I ended up having a bunch of messages (as many as attachments, as expected), yet each Message had all of the attachments still present. Not a huge deal, but if the attachments are larger in size it may become significant.

I don't think there is a one size fits all solution, and I am not in favor of introducing yet another configuration in the splitter to remove the attachments.

Thoughts?
Hadrian

Reply via email to