camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: @Consume creates multiple consumers when using multiple camel contexts
Date Thu, 25 Jun 2009 05:33:21 GMT
On Wed, Jun 24, 2009 at 8:50 PM, ariekenb <aaron.j.riekenberg@lmco.com>wrote:

>
> I just stumbled into an issue where using an @Consume annotation on a bean
> ended up creating 2 consumers when that bean was deployed in an OSGi bundle
> containing 2 camel contexts.
>
> It appears 1 consumer is created for each @Consume annotation for each
> context, even if the endpoint the @Consume references is only present in
> one
> of the contexts.


@Consume will create the endpoint if not already defined in the camel
context.

And I assume @Consume is in some code that is shared between multiple camel
contexts?
And that you have <package> to scan in the same classpaths in your camel
context configurations?

If you set the <package> to use different classpaths then you can control
which camel context
that looks into which packages.



>
>
> This can cause not very obvious threading problems - a consumer might
> unexpectedly receive messages in multiple threads if a new camel context is
> added to the bundle.
>
> I don't see any way to explicitly bind @Consume to a particular context.
> Has anyone ever considered adding an option to the annotation to specify a
> context name?
>

Yeah that could be a good idea to add some sort of qualifier or context
option to limit
it a certain context. But an option like: context="camel-1" would do for now
I think.



>
> Thanks,
> Aaron
> --
> View this message in context:
> http://www.nabble.com/%40Consume-creates-multiple-consumers-when-using-multiple-camel-contexts-tp24190660p24190660.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message