You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ross Woolf <ro...@rosswoolf.com> on 2023/07/26 00:00:30 UTC

splitting mail attachments with attachment as body

I'm wanting to make the attachments to be a byte array as the body of the
message, but the documentation is unclear to me how I can do this.

In the mail component documentation at
https://camel.apache.org/components/3.21.x/mail-component.html  it says:
---------------
<split>
  <method
beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/>
  <to uri="mock:split"/>
</split>
You can also split the attachments as byte[] to be stored as the message
body. This is done by creating the expression with boolean true

SplitAttachmentsExpression split = SplitAttachmentsExpression(true);
And then use the expression with the splitter EIP.
-----------------
I'm using XML DSL and I'm not sure how I do this part in XML:
"SplitAttachmentsExpression split = SplitAttachmentsExpression(true);"

 Can someone help me understand how to construct that as part of the XML
DSL so that the attachments will become the body of the message?

Re: splitting mail attachments with attachment as body

Posted by Federico Mariani <fe...@gmail.com>.
Hi Roos,

If you are using camel 4, you can use XML DSL in order to define beans
https://camel.apache.org/components/next/others/java-xml-io-dsl.html in
particular, something like

<camel> <bean name="beanFromProps" type=
"org.apache.camel.component.mail.SplitAttachmentsExpression"> <
constructor-arg index="0" value="true"/> </bean> </camel>

Regards,
Federico

Il giorno mer 26 lug 2023 alle ore 09:14 Alexandre Gallice <
aldettinger@gmail.com> ha scritto:

> Hi Roos,
>
>   I've never tested that. One could try to experiment creating a bean which
> is runtime specific.
> And then use that bean from the splitter.
>
>   With Camel Quarkus runtime, maybe it would give something ala:
> @Named("myBean")
> SplitAttachmentsExpression exp = new SplitAttachmentsExpression(true);
>
> And then use it from a splitter with:
> <method ref="myBean"
>
> https://camel.apache.org/manual/registry.html
>
> hth,
> Alex
>
>
> On Wed, Jul 26, 2023 at 2:01 AM Ross Woolf <ro...@rosswoolf.com> wrote:
>
> > I'm wanting to make the attachments to be a byte array as the body of the
> > message, but the documentation is unclear to me how I can do this.
> >
> > In the mail component documentation at
> > https://camel.apache.org/components/3.21.x/mail-component.html  it says:
> > ---------------
> > <split>
> >   <method
> > beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/>
> >   <to uri="mock:split"/>
> > </split>
> > You can also split the attachments as byte[] to be stored as the message
> > body. This is done by creating the expression with boolean true
> >
> > SplitAttachmentsExpression split = SplitAttachmentsExpression(true);
> > And then use the expression with the splitter EIP.
> > -----------------
> > I'm using XML DSL and I'm not sure how I do this part in XML:
> > "SplitAttachmentsExpression split = SplitAttachmentsExpression(true);"
> >
> >  Can someone help me understand how to construct that as part of the XML
> > DSL so that the attachments will become the body of the message?
> >
>

Re: splitting mail attachments with attachment as body

Posted by Alexandre Gallice <al...@gmail.com>.
Hi Roos,

  I've never tested that. One could try to experiment creating a bean which
is runtime specific.
And then use that bean from the splitter.

  With Camel Quarkus runtime, maybe it would give something ala:
@Named("myBean")
SplitAttachmentsExpression exp = new SplitAttachmentsExpression(true);

And then use it from a splitter with:
<method ref="myBean"

https://camel.apache.org/manual/registry.html

hth,
Alex


On Wed, Jul 26, 2023 at 2:01 AM Ross Woolf <ro...@rosswoolf.com> wrote:

> I'm wanting to make the attachments to be a byte array as the body of the
> message, but the documentation is unclear to me how I can do this.
>
> In the mail component documentation at
> https://camel.apache.org/components/3.21.x/mail-component.html  it says:
> ---------------
> <split>
>   <method
> beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/>
>   <to uri="mock:split"/>
> </split>
> You can also split the attachments as byte[] to be stored as the message
> body. This is done by creating the expression with boolean true
>
> SplitAttachmentsExpression split = SplitAttachmentsExpression(true);
> And then use the expression with the splitter EIP.
> -----------------
> I'm using XML DSL and I'm not sure how I do this part in XML:
> "SplitAttachmentsExpression split = SplitAttachmentsExpression(true);"
>
>  Can someone help me understand how to construct that as part of the XML
> DSL so that the attachments will become the body of the message?
>