I am looking forward to achieve the multipart file upload with camel 3.2.0 version and JDK11.
I was able to successfully do the same with the older version of camel 2.x using the below code,
.post("/importFile")
.id("importFile")
.bindingMode(RestBindingMode.off)
.consumes("multipart/form-data")
.produces(IConstants.APPLICATION_JSON)
.outType(String.class)
.to("direct:importFile")
from("direct:importFile")
.unmarshal()
.mimeMultipart()
.split().attachments()
// further processing...
After upgrading the camel version from 2.x to 3.2.0, we were getting an compile time issue in the above code for ".attachments()". As a result, we replaced the from route by,
SplitAttachmentsExpression split = new SplitAttachmentsExpression();
from("direct:importFile")
.unmarshal()
.mimeMultipart()
.split(split)
// further processing...
However, after this when i debug the code i am getting null attachments.
SplitAttachmentsExpression->evaluate()->exchange.getIn(AttachmentMessage.class).hasAttachments()
==> evaluates to false.
Am i missing anything here as part of the upgrade? Has the import file functionality changed with latest version of Camel? A quick help is highly appreciated as this was working earlier and now we are completely blocked!