You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2019/11/24 11:28:00 UTC

[jira] [Commented] (CAMEL-14212) camel-groovy does not export correct "properties" property

    [ https://issues.apache.org/jira/browse/CAMEL-14212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16981044#comment-16981044 ] 

Claus Ibsen commented on CAMEL-14212:
-------------------------------------

camel-script is deprecated
https://github.com/apache/camel/blob/camel-2.x/components/camel-script/pom.xml#L31

And it may be that you are using camel-groovy directly and not camel-script. But camel-script is deprecated and as such dont use it.

> camel-groovy does not export correct "properties" property
> ----------------------------------------------------------
>
>                 Key: CAMEL-14212
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14212
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-groovy
>    Affects Versions: 2.20.4, 2.24.0
>            Reporter: Francesco Boscarino
>            Priority: Major
>
> groovy language is expected to export "properties" as org.apache.camel.builder.script.PropertiesFunction but it turns out "properties" is a LinkedHashMap without .resolve() method.
> Just try the simple context:
> {{<?xml version="1.0" encoding="UTF-8"?>}}
> {{<beans xmlns="http://www.springframework.org/schema/beans"}}{{xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"}}{{xsi:schemaLocation="}}{{http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd}}{{http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">}}
>  
> {{<bean id="properties"class="org.apache.camel.component.properties.PropertiesComponent">}}
> {{<property name="location" value="classpath:myprop.properties"/>}}
> {{</bean>}}
> {{<camelContext xmlns="http://camel.apache.org/schema/spring">}}
> {{<route>}}
> {{<from uri="timer:timer?repeatCount=1"/>}}
> {{<setBody>}}
> {{<groovy>}}{{properties}}{{</groovy>}}
> {{</setBody>}}
> {{<to uri="log:debug?showAll=true&amp;multiline=true"/>}}
> {{</route>}}
> {{</camelContext>}}
> {{</beans>}}
>  
> {{The output is:}}
> [l-1) thread #2 - timer://timer] debug                          INFO  Exchange[
> , Id: ID-mba2015-lan-1574592722421-0-1
> , ExchangePattern: InOnly
> , Properties: \{CamelCreatedTimestamp=Sun Nov 24 11:52:03 CET 2019, CamelExternalRedelivered=false, CamelMessageHistory=[DefaultMessageHistory[routeId=route1, node=setBody1], DefaultMessageHistory[routeId=route1, node=to1]], CamelTimerCounter=1, CamelTimerFiredTime=Sun Nov 24 11:52:03 CET 2019, CamelTimerName=timer, CamelTimerPeriod=1000, CamelToEndpoint=log://debug?multiline=true&showAll=true}
> , Headers: \{breadcrumbId=ID-mba2015-lan-1574592722421-0-1, firedTime=Sun Nov 24 11:52:03 CET 2019}
> , *BodyType: java.util.LinkedHashMap*
> , Body: \{class=class script1574592724113926053069, binding=groovy.lang.Binding@748ee9f1}
> , Out: null: 
> ]



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