You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Etienne Robinet <er...@apache.org> on 2020/04/08 12:35:12 UTC
Camel 3.x - Referencing Bean
Hi all,
I have a blueprint that uses a Component (plc4x) to fetch data from a PLC. The Consumer need a parameter called "tags" which is a List<Object>. In Camel 2.24.2, I used to reference the list in the uri like this: ...?tags=#beanTags where I created a Bean outside the context that looked like this:
<bean id="beanTags " class="java.util.ArrayList">
<argument>
<list>
<bean class="org.apache.plc4x.camel.TagData">
<argument index="0" value="Date Structure : Month"/>
<argument index="1" value="%Date.Month"/>
</bean>
<bean class="org.apache.plc4x.camel.TagData">
<argument index="0" value="DIntTest"/>
<argument index="1" value="%test_dint"/>
</bean>
<bean class="org.apache.plc4x.camel.TagData">
<argument index="0" value="ArrayTest"/>
<argument index="1" value="%testLargeRealArray:10"/>
</bean>
</list>
</argument>
</bean>
This does not work with Camel 3.1.0. From the logs, the component gets a String called "beanTags" and can not set the parameter on the Endpoint.
Anyone know how to achieve the same "#reference" with Camel 3.x?
Thanks,
Etienne
Re: Camel 3.x - Referencing Bean
Posted by Etienne Robinet <er...@apache.org>.
Hi Claus,
it still gets me the same error. I am the one actually implementing the PLC4X Component, so maybe I did a mistake by upgrading to 3.x in the Endpoint implementation?
Here is the Endpoint: https://github.com/apache/plc4x/blob/develop/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java
Thank you,
Etienne
On 2020/04/08 12:47:04, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Try with
>
> tags=#bean:beanTags
>
>
> On Wed, Apr 8, 2020 at 2:35 PM Etienne Robinet <er...@apache.org> wrote:
> >
> > Hi all,
> > I have a blueprint that uses a Component (plc4x) to fetch data from a PLC. The Consumer need a parameter called "tags" which is a List<Object>. In Camel 2.24.2, I used to reference the list in the uri like this: ...?tags=#beanTags where I created a Bean outside the context that looked like this:
> >
> > <bean id="beanTags " class="java.util.ArrayList">
> > <argument>
> > <list>
> > <bean class="org.apache.plc4x.camel.TagData">
> > <argument index="0" value="Date Structure : Month"/>
> > <argument index="1" value="%Date.Month"/>
> > </bean>
> > <bean class="org.apache.plc4x.camel.TagData">
> > <argument index="0" value="DIntTest"/>
> > <argument index="1" value="%test_dint"/>
> > </bean>
> > <bean class="org.apache.plc4x.camel.TagData">
> > <argument index="0" value="ArrayTest"/>
> > <argument index="1" value="%testLargeRealArray:10"/>
> > </bean>
> > </list>
> > </argument>
> > </bean>
> >
> > This does not work with Camel 3.1.0. From the logs, the component gets a String called "beanTags" and can not set the parameter on the Endpoint.
> > Anyone know how to achieve the same "#reference" with Camel 3.x?
> > Thanks,
> > Etienne
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: Camel 3.x - Referencing Bean
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Try with
tags=#bean:beanTags
On Wed, Apr 8, 2020 at 2:35 PM Etienne Robinet <er...@apache.org> wrote:
>
> Hi all,
> I have a blueprint that uses a Component (plc4x) to fetch data from a PLC. The Consumer need a parameter called "tags" which is a List<Object>. In Camel 2.24.2, I used to reference the list in the uri like this: ...?tags=#beanTags where I created a Bean outside the context that looked like this:
>
> <bean id="beanTags " class="java.util.ArrayList">
> <argument>
> <list>
> <bean class="org.apache.plc4x.camel.TagData">
> <argument index="0" value="Date Structure : Month"/>
> <argument index="1" value="%Date.Month"/>
> </bean>
> <bean class="org.apache.plc4x.camel.TagData">
> <argument index="0" value="DIntTest"/>
> <argument index="1" value="%test_dint"/>
> </bean>
> <bean class="org.apache.plc4x.camel.TagData">
> <argument index="0" value="ArrayTest"/>
> <argument index="1" value="%testLargeRealArray:10"/>
> </bean>
> </list>
> </argument>
> </bean>
>
> This does not work with Camel 3.1.0. From the logs, the component gets a String called "beanTags" and can not set the parameter on the Endpoint.
> Anyone know how to achieve the same "#reference" with Camel 3.x?
> Thanks,
> Etienne
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2