You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Matthias Leinweber <m....@datatactics.de> on 2021/07/06 19:57:30 UTC

Camel routeTemplate

 Hello,

i am trying to use routeTemplates within karaf with DSL but i  don't find
any examples how to create routes with XML DSL. Also
https://camel.apache.org/manual/latest/route-template.html#_creating_routes_from_properties_file
seems not wo work in karaf.

Any suggestions?

br,
Matthias

Re: Camel routeTemplate

Posted by Matthias Leinweber <m....@datatactics.de>.
Hello again,

I looked into the source..

What do you think about adding RouteTemplateParameterSource interface to
public class BlueprintPropertiesSource extends ServiceSupport implements
PropertiesSource?

Otherwise I would work with a simple service like
MyRouteTemplateParameterSource implements RouteTemplateParameterSource.

But How can I trigger the reload of a blueprint? The only "hackaround" i
could think of would be something like this
<cm:property-placeholder
persistent-id="same-config-which-configs-my-MyRouteTemplateParameterSource
" update-strategy="reload"/> ?
Or is there a better mechanism to restart a blueprint bundle with an event
e.g. EventAdmin? i only found one point in code where
blueprintContainer.reload(); is called.

What do you think?


BR
Matthias


Am Mi., 7. Juli 2021 um 12:54 Uhr schrieb Matthias Leinweber <
m.leinweber@datatactics.de>:

> Hello Jb,
>
> i wasn't looking for the basic stuff... I tried this:
> And yes i  configured cm:property-paceholder from osgi config (Which is
> working with reloading) but this here doesn't work
>
> <camelContext>
>   <routeTemplate id="myTemplate">
>     <templateParameter name="name"/>
>     <templateParameter name="greeting"/>
>     <templateParameter name="myPeriod" defaultValue="3s"/>
>     <route>
>       <from uri="timer:{{name}}?period={{myPeriod}}"/>
>       <setBody><simple>{{greeting}} ${body}</simple></setBody>
>       <log message="${body}"/>
>     </route>
>   </routeTemplate></camelContext>
>
>
> And in spring application.props you can do something like the following
> what i added to the osgi config. Its quite handy when you want to create
> multiple kafka consumer within one context e.g.
>
> camel.route-template[0].template-id=myTemplatecamel.route-template[0].name=Jeancamel.route-template[0].greeting=cheese
> camel.route-template[1].template-id=myTemplatecamel.route-template[1].name=Matthiascamel.route-template[1].greeting=wurst
>
>
> Btw i had an outher Caml regarded question .. injecting karaf JAAS into jetty and kubernetes clustering support.
>
> BR,
>
> Matthias
>
>
> Am Mi., 7. Juli 2021 um 09:26 Uhr schrieb Jean-Baptiste Onofre <
> jb@nanthrax.net>:
>
>> Hi Mathias,
>>
>> Is it what you are looking for:
>> https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint
>>  ?
>>
>> Regards
>> JB
>>
>> Le 6 juil. 2021 à 21:57, Matthias Leinweber <m....@datatactics.de>
>> a écrit :
>>
>>  Hello,
>>
>> i am trying to use routeTemplates within karaf with DSL but i  don't find
>> any examples how to create routes with XML DSL. Also
>> https://camel.apache.org/manual/latest/route-template.html#_creating_routes_from_properties_file
>> seems not wo work in karaf.
>>
>> Any suggestions?
>>
>> br,
>> Matthias
>>
>>
>>
>
> --
>
> Matthias Leinweber
>
> Telefon: +49 176 810 24580
> E-Mail: m.leinweber@datatactics.de
> Internet: http://www.datatactics.de
>
> datatactics GmbH, Sitz der Gesellschaft: Frankfurt am Main,
> Registergericht: Amtsgericht Frankfurt am Main, HRB 121394, Geschäftsführer
> Matthias Leinweber
>

Re: Camel routeTemplate

Posted by Matthias Leinweber <m....@datatactics.de>.
Hello Jb,

i wasn't looking for the basic stuff... I tried this:
And yes i  configured cm:property-paceholder from osgi config (Which is
working with reloading) but this here doesn't work

<camelContext>
  <routeTemplate id="myTemplate">
    <templateParameter name="name"/>
    <templateParameter name="greeting"/>
    <templateParameter name="myPeriod" defaultValue="3s"/>
    <route>
      <from uri="timer:{{name}}?period={{myPeriod}}"/>
      <setBody><simple>{{greeting}} ${body}</simple></setBody>
      <log message="${body}"/>
    </route>
  </routeTemplate></camelContext>


And in spring application.props you can do something like the following
what i added to the osgi config. Its quite handy when you want to create
multiple kafka consumer within one context e.g.

camel.route-template[0].template-id=myTemplatecamel.route-template[0].name=Jeancamel.route-template[0].greeting=cheese
camel.route-template[1].template-id=myTemplatecamel.route-template[1].name=Matthiascamel.route-template[1].greeting=wurst


Btw i had an outher Caml regarded question .. injecting karaf JAAS
into jetty and kubernetes clustering support.

BR,

Matthias


Am Mi., 7. Juli 2021 um 09:26 Uhr schrieb Jean-Baptiste Onofre <
jb@nanthrax.net>:

> Hi Mathias,
>
> Is it what you are looking for:
> https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint
>  ?
>
> Regards
> JB
>
> Le 6 juil. 2021 à 21:57, Matthias Leinweber <m....@datatactics.de>
> a écrit :
>
>  Hello,
>
> i am trying to use routeTemplates within karaf with DSL but i  don't find
> any examples how to create routes with XML DSL. Also
> https://camel.apache.org/manual/latest/route-template.html#_creating_routes_from_properties_file
> seems not wo work in karaf.
>
> Any suggestions?
>
> br,
> Matthias
>
>
>

-- 

Matthias Leinweber

Telefon: +49 176 810 24580
E-Mail: m.leinweber@datatactics.de
Internet: http://www.datatactics.de

datatactics GmbH, Sitz der Gesellschaft: Frankfurt am Main,
Registergericht: Amtsgericht Frankfurt am Main, HRB 121394, Geschäftsführer
Matthias Leinweber

Re: Camel routeTemplate

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Mathias,

Is it what you are looking for: https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint <https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint> ?

Regards
JB

> Le 6 juil. 2021 à 21:57, Matthias Leinweber <m....@datatactics.de> a écrit :
> 
>  Hello,
> 
> i am trying to use routeTemplates within karaf with DSL but i  don't find any examples how to create routes with XML DSL. Also https://camel.apache.org/manual/latest/route-template.html#_creating_routes_from_properties_file <https://camel.apache.org/manual/latest/route-template.html#_creating_routes_from_properties_file> seems not wo work in karaf.
> 
> Any suggestions?
> 
> br,
> Matthias
>