Thank you for clarifying that the string for toD is already a simple string.
However, it still fails with the same exception at runtime:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder
'header.SMID' in value "file://.?fileName=status-${header.SMID}.txt"
-Steve
> -----Original Message-----
> From: Claus Ibsen <[email protected]>
> Sent: Wednesday, June 26, 2019 11:41 PM
> To: [email protected]
> Subject: Re: How to use simple expression in properties file?
>
> On Wed, Jun 26, 2019 at 11:49 PM Steve Huston <[email protected]>
> wrote:
> >
> > Is it possible to put a simple() expression in a properties string and have
> Camel evaluate it at run time?
> >
> > Here's what I'm trying to do:
> > - Set a message header ID with a value I want to use later
> > - Use .toD("{{event.sink}}")
> >
> > application.properties can then have something like:
> >
> > event.sink = simple("file://.?fileName=status-${header.ID}.txt")
> >
>
> toD using a string is simple language already, so just use
>
> event.sink = file://.?fileName=status-${header.ID}.txt
>
> > The goal being to have a message body written to a file whose name
> includes the ID header value.
> >
> > When I try to run this I get an exception:
> >
> > Caused by: java.lang.IllegalArgumentException: Could not resolve
> placeholder 'header.ID' in value "simple("file://.?fileName=status-
> ${header.ID}.txt")"
> >
>
> And you can use $simple{xxx} syntax for the fileName value
>
>
>
> > Thanks,
> > -Steve
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2