camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Endpoint and Producer isSingleton behavior in the OSGi
Date Thu, 25 Oct 2012 08:49:14 GMT
On Thu, Oct 25, 2012 at 10:18 AM, Zhemzhitsky Sergey
<> wrote:
> Hello camel gurus,
> I just need some clarification about how DefaultEndpoint, DefaultProducer behave depends
on whether their isSingleton method returns true or false.
> My understanding is the follosing:
> 1.       If DefaultEndpoint.isSingleton() returns true the same instance of the endpoint
will be reused across all the camel contexts, and in case of OSGi this mean that the same
endpoint instance will be reused across all the bundles that contain some camel functionality.

No its reused per CamelContext. Endpoints / producers / consumers et
all is per CamelContext and not shared across bundles.

> 2.       If DefaultEndpoint.isSingleton() returns false then for each camel context a
new instance of the endpoint is created and in the OSGi the new instance of the endpoint will
be created for each separate bundle that contains a camel context.

if false, then the endpoint is not stored in the endpoint registry for
any re-use. And on each endpoint lookup a new instance is created.

> 3.       If DefaultProducer.isSingleton() returns true then the same instance of the
producer, i.e., will be used every time not depending on the endpoint uri, i.e. for the following
producers <to uri=”comp:producer?param1=val1”/> and <to uri=”comp:producer?param1=val1&param2=val2”/>
will be used the same instance of the producer?

No these are 2 different endpoints (unless the endpoint supports
lenient properties - eg a bit special but think like a http endpoint
where any of the uri parameters can be dynamic, but you want to use
the same Camel endpoint)

> 4.       If DefaultProducer.isSingleton() returns false then for the different endpoint
URIs will be returned different instances of producer.
> So summarizing all the points above if DefaultEndpoint.isSingleton() is true and DefaultProducer.isSingleton()
in the OSGi environment then the producers will be shared across all the camel contexts located
in all the OSGi bundles, right?
> Best Regards,
> Sergey
> _______________________________________________________
> CONFIDENTIALITY NOTICE: This email and any files attached to it may be confidential.
If you are not the intended recipient you are notified that using, copying, distributing or
taking any action in reliance on the contents of this information is strictly prohibited.
If you have received this email in error please notify the sender and delete this email.

Claus Ibsen
Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message