Dhairya-007 opened a new pull request, #30050:
URL: https://github.com/apache/camel/pull/30050

   ## Problem
   
   `SplitAttachmentsExpression` is the supported way to split a mail message 
per attachment, and it stamps the attachment name onto each message it produces:
   
   ```java
   private Message extractAttachment(Attachment attachment, String 
attachmentName, CamelContext camelContext)
           throws Exception {
       final Message outMessage = new DefaultMessage(camelContext);
       outMessage.setHeader(HEADER_NAME, attachmentName);
   ```
   
   That name is the only way a route can tell the split messages apart, and the 
class Javadoc says so. But the constant is declared in the expression class 
rather than in `MailConstants`:
   
   ```java
   public static final String HEADER_NAME = "CamelSplitAttachmentId";
   ```
   
   `MailConstants` is what `MailEndpoint` names as its `headersClass`, so 
`CamelSplitAttachmentId` is absent from `imap.json`, `imaps.json`, `pop3.json`, 
`pop3s.json`, `smtp.json` and `smtps.json`, from the catalog, and from the 
generated header table - while the other mail headers around it 
(`CamelMailMessageId`, `CamelMailDelete`, `CamelMailMoveTo`, ...) are all 
documented.
   
   ## Fix
   
   Declare it in `MailConstants` with `@Metadata`, and have 
`SplitAttachmentsExpression.HEADER_NAME` take its value from there. 
`HEADER_NAME` is public API, so it stays, and the string is unchanged.
   
   While in that Javadoc, the sentence describing the header reads:
   
   > In both cases the attachment name is written to a the camel header 
"CamelSplitAttachmentId"
   
   "to a the camel header" is now "to the Camel header", and the sentence 
points at the new constant.
   
   The regenerated json files for the six schemes are included, along with 
their catalog copies.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to