You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lleclerc <ll...@aim-rg.com> on 2013/04/24 21:57:37 UTC

Bug in DefaultCamelContext with TypeConverter

Hi,

I am fusing OsgiDefaultCamelContext with GuiceCamelContext by doing the
"Guicyfication" of
all osgi resolvers to be injected of BundleContext, which is injected in
GuiceCamelContext. 

The only problem is TypeConverter, because if it is set manually this method
:


It will never be added with addService(typeConverter);


When used with GuiceCamelContext, you had expect it to be added, see : 


We could change DefaultCamelContext as follow :

to


and add the next 2 following lines in the doStartCamel() method next to the
other addService



Please let me know what you think about this change.



--
View this message in context: http://camel.465427.n5.nabble.com/Bug-in-DefaultCamelContext-with-TypeConverter-tp5731480.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Ambiguity in DefaultCamelContext with TypeConverter

Posted by lleclerc <ll...@aim-rg.com>.
JIRA : https://issues.apache.org/jira/browse/CAMEL-6321



--
View this message in context: http://camel.465427.n5.nabble.com/Ambiguity-in-DefaultCamelContext-with-TypeConverter-tp5731480p5731634.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Ambiguity in DefaultCamelContext with TypeConverter

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah the addService(typeConverter) should be moved to the doStartCamel
method, where we do this for others services.

Then we can remove that logic from createTypeConverter.

Fell free to log a JIRA and provide a patch.


On Thu, Apr 25, 2013 at 3:46 PM, lleclerc <ll...@aim-rg.com> wrote:
> I have picked the code from OsgiCamelContextHelper to set the osgi parts, but
> this helper do not apply for TypeConverter.
>
> Here is the code for OsgiDefaultCamelContext :
>
>
> It override the createTypeConverter() and addService is done while using a
> getter from DefaultCamelContext (see my first post).
>
> It is not a bug, I could go by creating a CamelContext which is GuiceOsgi.
> It's just that it would be cleaner to have a safe way to set the existing
> parts instead of redefining the camelContext, but it will do the job.
>
> Please let me know if it worth a change in DefaultCamelContext.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bug-in-DefaultCamelContext-with-TypeConverter-tp5731480p5731546.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Ambiguity in DefaultCamelContext with TypeConverter

Posted by lleclerc <ll...@aim-rg.com>.
I have picked the code from OsgiCamelContextHelper to set the osgi parts, but
this helper do not apply for TypeConverter.

Here is the code for OsgiDefaultCamelContext :


It override the createTypeConverter() and addService is done while using a
getter from DefaultCamelContext (see my first post).

It is not a bug, I could go by creating a CamelContext which is GuiceOsgi. 
It's just that it would be cleaner to have a safe way to set the existing
parts instead of redefining the camelContext, but it will do the job.

Please let me know if it worth a change in DefaultCamelContext.



--
View this message in context: http://camel.465427.n5.nabble.com/Bug-in-DefaultCamelContext-with-TypeConverter-tp5731480p5731546.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bug in DefaultCamelContext with TypeConverter

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need to use OsgiCamelContextHelper to set the osgi bits on the context.

When using camel-spring (spring-dm) or camel-blueprint, then this is
done automatic.
But when you do osgi manually you need to setup osgi a bit more manually.


On Wed, Apr 24, 2013 at 10:12 PM, lleclerc <ll...@aim-rg.com> wrote:
>
> I was wondering why OsgiDefaultCamelContext wasn't setting directly the
> TypeConverter and went for overwritting the createTypeConverter method. I
> think it's a work around because it was never added as a service.
>
> Here is my GuiceOsgiTypeConverter :
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bug-in-DefaultCamelContext-with-TypeConverter-tp5731480p5731482.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Bug in DefaultCamelContext with TypeConverter

Posted by lleclerc <ll...@aim-rg.com>.
I was wondering why OsgiDefaultCamelContext wasn't setting directly the
TypeConverter and went for overwritting the createTypeConverter method. I
think it's a work around because it was never added as a service.

Here is my GuiceOsgiTypeConverter :




--
View this message in context: http://camel.465427.n5.nabble.com/Bug-in-DefaultCamelContext-with-TypeConverter-tp5731480p5731482.html
Sent from the Camel - Users mailing list archive at Nabble.com.