The reason is that I want to use Transactions and as far as I know, only
Spring supports this with PROPOGATION_REQUIRED.

Following line does not compile in standard RouteBulder:

Policy required
        = new SpringTransactionPolicy(bean(TransactionTemplate.class,
"PROPAGATION_REQUIRED")); 

If there is a way to do transactions in basic RouteBuilder I'm all for it ;)

Thanks
Andrew




willem.jiang wrote:
> 
> Why don't you use the RouterBuilder if you are using the Spring
> configuration file to scan the builders?
> 
> Willem
> andrew.hu...@2e-systems.com wrote:
>> Thanks,
>> 
>> Any idea if this would be possible to do via XML? The problem occurs when
>> Spring scans my packages during startup and finds a SpringRouteBuilder in
>> there. So if I can't do this from XML it would mean that I have to put my
>> SpringRouteBuilder in a package where Sprng can't scan it, then set it up
>> myself somehow.... A bit unsure of how I would go about that.
>> 
>> Regards
>> Andrew
>> 
>> willem.jiang wrote:
>>> Hi , 
>>>
>>> You can use 
>>> SpringCamelContext.springCamelContext(applicationContext);
>>> to create a SpringCamelContext from an applicationContext.
>>>
>>> Willem
>>>
>>>
>>>
>>> Too add a bit more information....
>>>
>>> I found the code which throws this error in the camel source base:
>>>
>>> public ApplicationContext getApplicationContext() {
>>> +        if (applicationContext == null) {
>>> +            CamelContext camelContext = getContext();
>>> +            if (camelContext instanceof SpringCamelContext) {
>>> +                SpringCamelContext springCamelContext =
>>> (SpringCamelContext) camelContext;
>>> +                return springCamelContext.getApplicationContext();
>>> +            }
>>> +            else {
>>> +                throw new IllegalArgumentException("This SpringBuilder
>>> is
>>> not being used
>>> with a SpringCamelContext and there is no applicationContext property
>>> configured");
>>> +            }
>>> +        }
>>>
>>>
>>> So the problem seems to be that I have an instance of CamelContext
>>> instead
>>> of SpringCamelContext. SpringcamelContext extends camelcontext
>>> incidently.
>>>
>>> the questions is - how can I create an instance of SpringCamelContext
>>> from
>>> within my Spring xml?
>>>
>>> To refer back to my original post, I have this piece of XML to create, I
>>> guess, a normal camelContext:
>>>
>>> <camel:camelContext id="camel2"
>>> xmlns="http://activemq.apache.org/camel/schema/spring";>
>>>         <camel:package>com.mycompany.mypackage</camel:package>
>>> </camel:camelContext> 
>>>
>>> I was hoping it would be as simply as changing "camelContext" to
>>> "SpringCamelContext" but sadly not ;)
>>>
>>> Can anyone indicate if this is something perhaps currently not
>>> supported,
>>> or hopefully offer a solution? maybe I can't use spring xml for this?
>>>
>>> I am using the SpringRouteBuilder because I want to be able to ensure
>>> that
>>> messages are persisted from 1 queue to another (i.e. if somebody pulls
>>> out
>>> the plug during processing within a bean, my message will still exist on
>>> the "from" queue and not be lost). So if Camel supports transactions
>>> another way, would gladly use that instead.
>>>
>>> Thanks for any feedback
>>>
>>> andrew
>>>
>>>
>>>
>> Quoted from: 
>> http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347500.html
>> 
>> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347997.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Reply via email to