You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Julien D <my...@hotmail.com> on 2009/08/31 11:24:14 UTC

Dynamic header setting

Hi guys,

Here's my situation.

I'm processing a file and I'm sending an email to tell the user that the
file is being processed.
I would like to put the file name in the subject of the email but I don't
know how to do that.

The file name is in the header CamelFileName.

Here's how I set the subject of the email without the file name :
.setHeader("subject", constant("Starting File processing "))

Any hint ?
-- 
View this message in context: http://www.nabble.com/Dynamic-header-setting-tp25220559p25220559.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Dynamic header setting

Posted by Claus Ibsen <cl...@gmail.com>.
And if you want access to a bit more information about the file you
can use the "File language" which is an extension to the simple
language.
http://camel.apache.org/file-language.html

It offers some other dynamic tokens you can use to get e.g. file
length, date etc.



On Mon, Aug 31, 2009 at 11:29 AM, Claus Ibsen<cl...@gmail.com> wrote:
> On Mon, Aug 31, 2009 at 11:24 AM, Julien D<my...@hotmail.com> wrote:
>>
>> Hi guys,
>>
>> Here's my situation.
>>
>> I'm processing a file and I'm sending an email to tell the user that the
>> file is being processed.
>> I would like to put the file name in the subject of the email but I don't
>> know how to do that.
>>
>> The file name is in the header CamelFileName.
>>
>> Here's how I set the subject of the email without the file name :
>> .setHeader("subject", constant("Starting File processing "))
>>
>> Any hint ?
>
> Yeah you can use the "simple" language for that as it can do it a bit dynamic
> http://camel.apache.org/simple.html
>
> You can just insert ${ } placeholders and then the simple language
> will do the replacing at runtime.
>
>  .setHeader("subject", simple("Starting File processing of
> ${header.CamelFileName} and the file is a good file."))
>
>
>> --
>
>> View this message in context: http://www.nabble.com/Dynamic-header-setting-tp25220559p25220559.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Dynamic header setting

Posted by Julien D <my...@hotmail.com>.
It's compiling that way finally

.setHeader("subject").simple("Starting File processing
${header.CamelFileName}")

Thanks Claus


Julien D wrote:
> 
> I tried this solution too but it does not compile for me. I'm using camel
> 2.0-M3.
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> On Mon, Aug 31, 2009 at 11:24 AM, Julien D<my...@hotmail.com> wrote:
>>>
>>> Hi guys,
>>>
>>> Here's my situation.
>>>
>>> I'm processing a file and I'm sending an email to tell the user that the
>>> file is being processed.
>>> I would like to put the file name in the subject of the email but I
>>> don't
>>> know how to do that.
>>>
>>> The file name is in the header CamelFileName.
>>>
>>> Here's how I set the subject of the email without the file name :
>>> .setHeader("subject", constant("Starting File processing "))
>>>
>>> Any hint ?
>> 
>> Yeah you can use the "simple" language for that as it can do it a bit
>> dynamic
>> http://camel.apache.org/simple.html
>> 
>> You can just insert ${ } placeholders and then the simple language
>> will do the replacing at runtime.
>> 
>>  .setHeader("subject", simple("Starting File processing of
>> ${header.CamelFileName} and the file is a good file."))
>> 
>> 
>>> --
>> 
>>> View this message in context:
>>> http://www.nabble.com/Dynamic-header-setting-tp25220559p25220559.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamic-header-setting-tp25220559p25220832.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Dynamic header setting

Posted by Julien D <my...@hotmail.com>.
I tried this solution too but it does not compile for me. I'm using camel
2.0-M3.


Claus Ibsen-2 wrote:
> 
> On Mon, Aug 31, 2009 at 11:24 AM, Julien D<my...@hotmail.com> wrote:
>>
>> Hi guys,
>>
>> Here's my situation.
>>
>> I'm processing a file and I'm sending an email to tell the user that the
>> file is being processed.
>> I would like to put the file name in the subject of the email but I don't
>> know how to do that.
>>
>> The file name is in the header CamelFileName.
>>
>> Here's how I set the subject of the email without the file name :
>> .setHeader("subject", constant("Starting File processing "))
>>
>> Any hint ?
> 
> Yeah you can use the "simple" language for that as it can do it a bit
> dynamic
> http://camel.apache.org/simple.html
> 
> You can just insert ${ } placeholders and then the simple language
> will do the replacing at runtime.
> 
>  .setHeader("subject", simple("Starting File processing of
> ${header.CamelFileName} and the file is a good file."))
> 
> 
>> --
> 
>> View this message in context:
>> http://www.nabble.com/Dynamic-header-setting-tp25220559p25220559.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamic-header-setting-tp25220559p25220776.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Dynamic header setting

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Aug 31, 2009 at 11:24 AM, Julien D<my...@hotmail.com> wrote:
>
> Hi guys,
>
> Here's my situation.
>
> I'm processing a file and I'm sending an email to tell the user that the
> file is being processed.
> I would like to put the file name in the subject of the email but I don't
> know how to do that.
>
> The file name is in the header CamelFileName.
>
> Here's how I set the subject of the email without the file name :
> .setHeader("subject", constant("Starting File processing "))
>
> Any hint ?

Yeah you can use the "simple" language for that as it can do it a bit dynamic
http://camel.apache.org/simple.html

You can just insert ${ } placeholders and then the simple language
will do the replacing at runtime.

 .setHeader("subject", simple("Starting File processing of
${header.CamelFileName} and the file is a good file."))


> --

> View this message in context: http://www.nabble.com/Dynamic-header-setting-tp25220559p25220559.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus