Luca Burgazzoli created CAMEL-14651:
---------------------------------------

             Summary: Property placeholder not resolved 
                 Key: CAMEL-14651
                 URL: https://issues.apache.org/jira/browse/CAMEL-14651
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.1.0
            Reporter: Luca Burgazzoli


I have a simple groovy script like:

{code:java}
@Grab(group='org.slf4j', module='slf4j-simple', version='1.7.30')
@Grab(group='org.apache.camel', module='camel-main', version='3.1.0')
@Grab(group='org.apache.camel', module='camel-timer', version='3.1.0')

import org.apache.camel.builder.RouteBuilder
import org.apache.camel.main.Main

def main = new Main()
main.addInitialProperty('camel.context.name', 'test-ctx')
main.addInitialProperty('message', 'test')
main.addRoutesBuilder(new RouteBuilder() {
    @Override
    void configure() {
        from('timer:{{message}}')
            .log('{{message}}');
    }
})

main.run()
{code}

Which is supposed to print test every second but what it does is to literally 
print {{message}} :

{code}
[main] INFO org.apache.camel.support.LRUCacheFactory - Detected and using 
LURCacheFactory: camel-caffeine-lrucache
[main] INFO org.apache.camel.main.BaseMainSupport - Using properties from 
classpath:application.properties;optional=true
[main] INFO org.apache.camel.main.BaseMainSupport - Auto-configuration summary:
[main] INFO org.apache.camel.main.BaseMainSupport -     
camel.context.name=test-ctx
[main] INFO org.apache.camel.main.DefaultRoutesCollector - Loading additional 
Camel XML routes from: classpath:camel/*.xml
[main] INFO org.apache.camel.main.DefaultRoutesCollector - Loading additional 
Camel XML rests from: classpath:camel-rest/*.xml
[main] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 
3.1.0 (CamelContext: test-ctx) is starting
[main] INFO org.apache.camel.impl.engine.DefaultManagementStrategy - JMX is 
disabled
[main] INFO org.apache.camel.impl.engine.HeadersMapFactoryResolver - Detected 
and using HeadersMapFactory: camel-headersmap
[main] INFO org.apache.camel.impl.engine.AbstractCamelContext - StreamCaching 
is not in use. If using streams then its recommended to enable stream caching. 
See more details at http://camel.apache.org/stream-caching.html
[main] INFO org.apache.camel.impl.engine.AbstractCamelContext - Route: route1 
started and consuming from: timer://test
[main] INFO org.apache.camel.impl.engine.AbstractCamelContext - Total 1 routes, 
of which 1 are started
[main] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 
3.1.0 (CamelContext: test-ctx) started in 0.099 seconds
[Camel (test-ctx) thread #2 - timer://test] INFO route1 - {{message}}
[Camel (test-ctx) thread #2 - timer://test] INFO route1 - {{message}}
{code}

Logs show that initial properties are taken into account as both the contex 
name and the name of the timer are set according to the properties whereas the 
Log EIP does not work as expected.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to