camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonin Stefanutti <anto...@stefanutti.fr>
Subject Re: CDI - Having 2 contexts within the same JVM
Date Thu, 11 Aug 2016 08:13:06 GMT
Hi Rajith,

> On 10 Aug 2016, at 16:54, Rajith Muditha Attapattu <rajith77@gmail.com> wrote:
> 
> Another worry I have is how to do transactions.
> If I'm not mistaken, Spring is the preferred transaction mechanism.

Some Camel components, like Spring JMS or the transactional error handler are tightly coupled
to Spring TX as they rely on the platform transaction manager. That being said, that doesn’t
prevent from using CDI and have CDI + JTA + Spring TX integrate nicely.

You can find a quick example here:

http://camel.apache.org/cdi.html#CDI-ReferringbeansfromEndpointURIs

I still have to contribute a full-fledged example...

Antonin

> On Wed, Aug 10, 2016 at 10:32 AM, Brad Johnson <brad.johnson@mediadriver.com
>> wrote:
> 
>> Part of the reason I asked that question is that if you are using blueprint
>> you start your route builder in the context in the XML file.  Spring is
>> similar.  CDI requires the annotation help and I haven't used it before
>> 2.17 so I'm not sure how ready for primetime it was before.
>> 
>> 
>> <bean id="myRoute" class="com.MyRoutes" />
>> 
>> 
>> <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>> 
>> <routeBuilder ref="myRoute" />
>> 
>> On Wed, Aug 10, 2016 at 9:13 AM, Rajith Muditha Attapattu <
>> rajith77@gmail.com> wrote:
>> 
>>> Thanks guys for the information.
>>> I'm using 2.15 ...as thats the version bundled with the Fuse 6.2.1
>> release.
>>> 
>>> On Tue, Aug 9, 2016 at 4:18 AM, Antonin Stefanutti <
>> antonin@stefanutti.fr>
>>> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> Camel CDI is capable of managing multiple Camel contexts within the
>> same
>>>> JVM / same CDI container. You can find more information in
>>>> http://camel.apache.org/cdi.html#CDI-MultipleCamelcontexts. It
>> documents
>>>> how to declare these contexts and how to bind RouteBuilder to them.
>>>> Generally, you would use the provided @ContextName qualifier to do the
>>>> binding though you can use your own qualifiers if needed.
>>>> 
>>>> As Brad mentioned, you may want to precise / check the Camel version
>>>> you’re using. Indeed, multiple Camel context support has been greatly
>>>> improved since Camel 2.17.0. You may be able to use it before that but
>>> not
>>>> all the typical use cases will work.
>>>> 
>>>> Let us know if that helps.
>>>> 
>>>> Antonin
>>>> 
>>>>> On 08 Aug 2016, at 20:48, Brad Johnson <brad.johnson@mediadriver.com
>>> 
>>>> wrote:
>>>>> 
>>>>> Which framework and version of Camel are you using?
>>>>> 
>>>>> On Mon, Aug 8, 2016 at 1:47 PM, Rajith Muditha Attapattu <
>>>> rajith77@gmail.com
>>>>>> wrote:
>>>>> 
>>>>>> Hey All,
>>>>>> 
>>>>>> Within the same JVM, there will be two camel contexts.
>>>>>> How do I mark a particular RouteBuilder to say it belongs to
>> Context1
>>> vs
>>>>>> Context2 ?
>>>>>> 
>>>>>> Is this even possible ?
>>>>>> 
>>>>>> Regards,
>>>>>> 
>>>>>> Rajith Muditha Attapattu <http://rajith.2rlabs.com/>
>>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Regards,
>>> 
>>> Rajith Muditha Attapattu <http://rajith.2rlabs.com/>
>>> 
>> 
> 
> 
> 
> -- 
> Regards,
> 
> Rajith Muditha Attapattu <http://rajith.2rlabs.com/>

Mime
View raw message