Hi

Yes see this page about configuring endpoints and the # syntax
http://camel.apache.org/how-do-i-configure-endpoints.html


On Mon, Apr 22, 2013 at 7:18 PM, javamonkey79 <[email protected]> wrote:
> Yes, that works perfectly. I got this to work:
>
>     <camelContext id="contextname">
>         <route id="routename">
>             <from uri="file://\temp\?fileName=#myGroovyExp" />
>             <split>
>                 <tokenize token="(?=MSH\|)" regex="true" />
>                 <to uri="bean:filePickupByDateTest?method=test" />
>             </split>
>         </route>
>     </camelContext>
>
>     <spring:bean id="myGroovyExp"
> class="org.apache.camel.model.language.GroovyExpression">
>         <spring:constructor-arg index="0" value="new
> Date().previous().format('MMddyy') + 'pa'" />
>     </spring:bean>
>
> Where my file names are yesterday MMddyypa.
>
> The hash bean name is just a global way to call beans from the camel
> context in Spring, no?
>
> Thanks!
>
>
> On Mon, Apr 22, 2013 at 1:36 AM, Claus Ibsen-2 [via Camel] <
> [email protected]> wrote:
>
>> Maybe something like
>>
>> <bean id="myGroovyExp"
>> class="org.apache.camel.model.language.GroovyExpression">
>>   <constructor-arg index="0" value="some groovy script here"/>
>> </bean>
>>
>> <to uri="file:xxxx?fileName=#myGroovyExp"/>
>>
>>
>>
>> On Fri, Apr 19, 2013 at 7:07 PM, javamonkey79 <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=5731214&i=0>>
>> wrote:
>>
>> > Is there any way to do this with a hybrid approach? e.g. Somehow set the
>> > filename as a property in the java code and then use that in the Spring
>> > DSL? If not, how would I get started on doing this in Spring DSL alone?
>> > Sorry so many questions, the documentation on this feature is hard to
>> > decipher and I was not able to find relevant unit tests either.
>> >
>> > Thanks much!
>> >
>> >
>> > On Fri, Apr 19, 2013 at 9:59 AM, Claus Ibsen-2 [via Camel] <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5731214&i=1>>
>> wrote:
>> >
>> >> There is a setter method that accepts an org.apache.camel.Expression.
>> >> So you can use that to use a GroovyExpression.
>> >>
>> >> Though if you want to do that from XML then that is not so easy.
>> >>
>> >> But from Java code its easier as its just to call set setter method,
>> >> on the FileEndpoint instance.
>> >>
>> >>
>> >>
>> >> On Fri, Apr 19, 2013 at 6:31 PM, javamonkey79 <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5731155&i=0>>
>> >> wrote:
>> >>
>> >> > This is from the documentation of the file2 component:
>> >> >
>> >> > Use Expression such as File Language to dynamically set the filename.
>> >> For
>> >> > consumers, it's used as a filename filter. For producers, it's used
>> to
>> >> > evaluate the filename to write. If an expression is set, it take
>> >> precedence
>> >> > over the CamelFileName header. (Note: The header itself can also be
>> an
>> >> > Expression). The expression options support both String and
>> Expression
>> >> > types. *If the expression is a String type, it is always evaluated
>> using
>> >> the
>> >> > File Language. If the expression is an Expression type, the specified
>> >> > Expression type is used* - this allows you, for instance, to use OGNL
>> >> > expressions.
>> >> >
>> >> > I'd like to be able to use a groovy expression, but for the life of
>> me
>> >> can't
>> >> > figure out how to do it. Can anyone provide an example, or have I
>> >> > misunderstood the documentation?
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >>
>> http://camel.465427.n5.nabble.com/use-of-expression-in-file-name-tp5731154.html
>> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> Red Hat, Inc.
>> >> FuseSource is now part of Red Hat
>> >> Email: [hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5731155&i=1>
>> >> Web: http://fusesource.com
>> >> Twitter: davsclaus
>> >> Blog: http://davsclaus.com
>> >> Author of Camel in Action: http://www.manning.com/ibsen
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>>
>> >> .
>> >> NAML<
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>> >>
>> >
>> >
>> >
>> > --
>> > Never attribute to malice that which is adequately explained by
>> stupidity.
>> > - Hanlon's razor
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/use-of-expression-in-file-name-tp5731154p5731157.html
>>
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5731214&i=2>
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/use-of-expression-in-file-name-tp5731154p5731214.html
>>  To unsubscribe from use of expression in file name, click 
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5731154&code=amF2YW1vbmtleTc5QGdtYWlsLmNvbXw1NzMxMTU0fDE5MTI5MTM4MA==>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> Never attribute to malice that which is adequately explained by stupidity.
> - Hanlon's razor
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/use-of-expression-in-file-name-tp5731154p5731283.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to