Hi Claus,

Current camel support to define a producer template OUTSIDE a camel context, I think it works well just like the autowire function which is provided in Spring.

If there more than two Camel context in the Spring Application context , the user should specify the camel context which the template should use.

But I have a concern that even we put the template INSIDE the camel context, the template will not be set with a right version of camel context, since we use a CamelPostProcessor to inject CamelContext.

So I did a quick test on the current Camel code and found there is a bug if there are more one CamelContext -- CamelPostProcessor will inject the last create camel context into the CamelContextAware object.

I suggest to change the CamelPostProcessor to skip bean which camelContext is set, but it need to change the CamelContextAware interface to add a method of getCamelContext.

Any thought ?

Willem




Claus Ibsen wrote:
Hi Willem

I actually didnt realize you could define a producer template OUTSIDE
a camel context.

I do think that is WRONG. As the template needs to hold a reference to
a CamelContext to work correctly.

But when people have 2+ camel context defined in the XML files then it
gets tricky, as which CamelContext should the template belong to.

I believe we should do the opposite and remove the option to define it
outside and only allow it to be defined within a camel context.
If not it should at least require a context attribute as well so you
can define which camel context it belongs to.


On Mon, Aug 3, 2009 at 6:10 AM, Willem Jiang<[email protected]> wrote:
FYI, I just committed a quick fix for this issue.
Please feel free to try out the latest snapshot[1], we publish the
snapshot every day.

[1] https://repository.apache.org/content/repositories/snapshots/

Willem

Willem Jiang wrote:
Hi,

I just found this is a bug of Camel.  I'm working on the quick fix now[1].
Here is a way that you can walk around this issue, by putting the
consumerTemplate definition inside the camel context.


    <camel:camelContext id="camel">
        <camel:consumerTemplate id="consumer"/>
    </camel:camelContext>
    <camel:template id="producer"/>


[1] https://issues.apache.org/activemq/browse/CAMEL-1870

Willem

Mick Knutson wrote:
I am using 2.0-M3

Should be trying the trunk instead?

---
Thank You…

Mick Knutson, President

BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233

Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---



On Sun, Aug 2, 2009 at 7:43 PM, Willem Jiang <[email protected]>
wrote:

Which version of Camel are you using ?
I just checked current Camel 2.0 trunk code, the <camel:consumer> tag
should work. Can you try to use the recent released Camel 2.0 M3 ?

Willem


Mick Knutson wrote:

I am trying to follow:
http://camel.apache.org/polling-consumer.html

Now in my camel-client.xml I defined:
*<beans xmlns="http://www.springframework.org/schema/beans"*
*       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"*
*       xmlns:camel="http://camel.apache.org/schema/spring"*
*       xsi:schemaLocation="*
*        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd*
*        http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>*


*    <!-- START SNIPPET: e2 -->*
*    <camel:camelContext id="camel"/>*
*    <camel:template id="producer"/>*
*   <camel:consumerTemplate id="consumer"/> *

But I keep getting:

*The matching wildcard is strict, but no declaration can be found for
element 'camel:consumerTemplate'.*

Then I changed it to:
*<camel:consumer id="consumer"/> *
**
**
But still get*
*
*Caused by:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Cannot locate BeanDefinitionParser for element
[consumer]*
*Offending resource: class path resource [camel-client.xml]*




---
Thank You…

Mick Knutson, President

BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233

Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---









Reply via email to