Raymond created CAMEL-22924:
-------------------------------

             Summary: Add setAttachment to simple language
                 Key: CAMEL-22924
                 URL: https://issues.apache.org/jira/browse/CAMEL-22924
             Project: Camel
          Issue Type: Improvement
    Affects Versions: 4.17.0
            Reporter: Raymond


Since 4.10.x, the simple language contains various functions to handle 
attachments. However, it's only possible to getAttachments, but not to set 
Attachments. Something like:


{code:java}
setAttachment(key, content)
setAttachment(key, content, type){code}

Some sidenotes:

1. The attachment key

To get a specific attachment, you need a key. From the documentation, it's not 
immediately clear what the 'key' is, and how to find out which keys are 
available. I tried something like keySet(), but that didn't work. Maybe a 
function


{code:java}
attachmentKeys{code}
That returns an array [key1, key2]. Where empty array [] means that there are 
no attachments (though you could also create a boolean function 
{*}hasAttachments{*}).

2. Documentation

I needed one attachment as text. I first followed Gemini that suggested 


{code:java}
attachmentContentAsText('myKey'){code}

This turned out to be incorrect. Maybe add one or two examples with the correct 
syntax:


{code:java}
attachmentContentAsText(myKey){code}

This would avoid asking AI or trial and error.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to