You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sekaijin <je...@sap.aphp.fr> on 2012/05/04 18:42:24 UTC

How to bind an object in the registry camel?

Hi

I use blueprint for my camel osgi bundles.

I don't understand how to register a dataformat or a codec in the registry
camel

My xml is as follows

and in my road builder I can not see my dataformat (I.E. my codec)


if I understand well
<Camel:Bindy adds dataformat in the blueprint  container.
but my "route" are looking in the registry camel.

How to bind an object in the registry camel?
xml does not seem to be the right solution.

and in the routebuilder getContext().getRegistry () returns a Registry that
does not support the bind method.

thank
Bye.
sorry for my approximative english


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to bind an object in the registry camel?

Posted by Claus Ibsen <cl...@gmail.com>.
What version of Camel are you using?



On Fri, May 4, 2012 at 6:42 PM, sekaijin <je...@sap.aphp.fr> wrote:
> Hi
>
> I use blueprint for my camel osgi bundles.
>
> I don't understand how to register a dataformat or a codec in the registry
> camel
>
> My xml is as follows
>
> and in my road builder I can not see my dataformat (I.E. my codec)
>
>
> if I understand well
> <Camel:Bindy adds dataformat in the blueprint  container.
> but my "route" are looking in the registry camel.
>
> How to bind an object in the registry camel?
> xml does not seem to be the right solution.
>
> and in the routebuilder getContext().getRegistry () returns a Registry that
> does not support the bind method.
>
> thank
> Bye.
> sorry for my approximative english
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: How to bind an object in the registry camel?

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, May 6, 2012 at 9:17 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Sat, May 5, 2012 at 4:19 PM, sekaijin <je...@sap.aphp.fr> wrote:
>> Hi
>>
>> My camel version is 2.8.0
>> I'm running fuseEsb 4.4
>>
>> Thank for this response.
>> but this does not answer to my problem.
>>
>
> I have logged a ticket to look into this
> https://issues.apache.org/jira/browse/CAMEL-5250
>
> It should be possible to define the data formats in the XML and
> reference them from a route in Java code.
>

You need to define your data formats inside the <camelContext>.
Then it should work.

  <camelContext xmlns="http://camel.apache.org/schema/spring">

    <dataFormats>
      <bindy id="myBindy" type="Csv"
classType="org.apache.camel.itest.osgi.bindy.Employee"/>
    </dataFormats>

    ...

  </camelContext>

Then you can refer to the data format using the id "myBindy"




>
>> if I define my bundle and my route with blueprint, the doc  is sufficient to
>> find a solution.
>>
>> my problem is I have to go through a routebuilder because my route can not
>> be determined at compile time.
>>
>> it is defined in the module loading. and as URLs, the presence or absence of
>> processors is determined by the values defined in a database. I do not
>> know in advance how many roads will be built.
>>
>> blueprint at startup, launches routebuilder. it reads the database and
>> builds the road.
>>
>> for the datasource for the codec and I do not see how I go from the registry
>>
>> for example
>> . to ("jdbc:" + getDatasourceNameInConfigBase())
>> or
>> . from ("mina: tcp: " + getHostNameInConfigBase(): getTCPPortInConfigBase()
>> + "?codec=#mllpHL7Codec")
>> require that MyDataSource either the registe and mllpHL7Codec also.
>>
>> how to place?
>> when blueprint gives a hand to routebuilder it can no longer make a bind on
>> the registry
>> blueprint does not provide access to the registry camel.
>>
>> Thank you for your help.
>> A+JYT
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392p5687980.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: How to bind an object in the registry camel?

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, May 5, 2012 at 4:19 PM, sekaijin <je...@sap.aphp.fr> wrote:
> Hi
>
> My camel version is 2.8.0
> I'm running fuseEsb 4.4
>
> Thank for this response.
> but this does not answer to my problem.
>

I have logged a ticket to look into this
https://issues.apache.org/jira/browse/CAMEL-5250

It should be possible to define the data formats in the XML and
reference them from a route in Java code.


> if I define my bundle and my route with blueprint, the doc  is sufficient to
> find a solution.
>
> my problem is I have to go through a routebuilder because my route can not
> be determined at compile time.
>
> it is defined in the module loading. and as URLs, the presence or absence of
> processors is determined by the values defined in a database. I do not
> know in advance how many roads will be built.
>
> blueprint at startup, launches routebuilder. it reads the database and
> builds the road.
>
> for the datasource for the codec and I do not see how I go from the registry
>
> for example
> . to ("jdbc:" + getDatasourceNameInConfigBase())
> or
> . from ("mina: tcp: " + getHostNameInConfigBase(): getTCPPortInConfigBase()
> + "?codec=#mllpHL7Codec")
> require that MyDataSource either the registe and mllpHL7Codec also.
>
> how to place?
> when blueprint gives a hand to routebuilder it can no longer make a bind on
> the registry
> blueprint does not provide access to the registry camel.
>
> Thank you for your help.
> A+JYT
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392p5687980.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: How to bind an object in the registry camel?

Posted by sekaijin <je...@sap.aphp.fr>.
Hi 

My camel version is 2.8.0
I'm running fuseEsb 4.4

Thank for this response.
but this does not answer to my problem.

if I define my bundle and my route with blueprint, the doc  is sufficient to
find a solution.

my problem is I have to go through a routebuilder because my route can not
be determined at compile time.

it is defined in the module loading. and as URLs, the presence or absence of
processors is determined by the values ​​defined in a database. I do not
know in advance how many roads will be built.

blueprint at startup, launches routebuilder. it reads the database and
builds the road.

for the datasource for the codec and I do not see how I go from the registry

for example
. to ("jdbc:" + getDatasourceNameInConfigBase()) 
or
. from ("mina: tcp: " + getHostNameInConfigBase(): getTCPPortInConfigBase()
+ "?codec=#mllpHL7Codec"​​)
require that MyDataSource either the registe and mllpHL7Codec also.

how to place?
when blueprint gives a hand to routebuilder it can no longer make a bind on
the registry
blueprint does not provide access to the registry camel.

Thank you for your help.
A+JYT

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392p5687980.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to bind an object in the registry camel?

Posted by Jon Anstey <ja...@gmail.com>.
I use camel-bindy in a Blueprint file here:
https://github.com/janstey/rider-auto-osgi/blob/master/rider-auto-normalizer/src/main/resources/OSGI-INF/blueprint/camel-context.xmlMaybe
that will help. You don't to explicitly add that to the registry.

Of course, for camel-bindy to be available to the blueprint container, you
will need the camel-bindy feature installed (if you are using a Karaf-based
container).

Cheers,
Jon

On Fri, May 4, 2012 at 2:12 PM, sekaijin <je...@sap.aphp.fr>wrote:

> Hi
>
> I use blueprint for my camel osgi bundles.
>
> I don't understand how to register a dataformat or a codec in the registry
> camel
>
> My xml is as follows
>
> and in my road builder I can not see my dataformat (I.E. my codec)
>
>
> if I understand well
> <Camel:Bindy adds dataformat in the blueprint  container.
> but my "route" are looking in the registry camel.
>
> How to bind an object in the registry camel?
> xml does not seem to be the right solution.
>
> and in the routebuilder getContext().getRegistry () returns a Registry that
> does not support the bind method.
>
> thank
> Bye.
> sorry for my approximative english
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Cheers,
Jon
---------------
FuseSource
Email: jon@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen

Re: How to bind an object in the registry camel?

Posted by sekaijin <je...@sap.aphp.fr>.
HI

I see a strange phenomenon

in the constructor of routebuilder
this.getContext().getRegistry() returns
org.apache.camel.impl.*JndiRegistry*@5f393d
and
this.getContext().getRegistry().lookup("PhedraJaxb") returns
org.apache.camel.converter.jaxb.JaxbDataFormat @ 1b3a2ad

but in the configure() method of routebuilder
this.getContext().getRegistry() returns
org.apache.camel.impl.*CompositeRegistry*@1c1c806
and
this.getContext().getRegistry().lookup("PhedraJaxb") returns
raise org.osgi.service.blueprint.container.NoSuchComponentException

hoping it can help find the solution
A + JYT

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-bind-an-object-in-the-registry-camel-tp5686392p5690697.html
Sent from the Camel - Users mailing list archive at Nabble.com.