Transactions and Cache Levels

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Transactions and Cache Levels

Darwish
Hi,

im using transacted route which consuming exchanges from JMS component ( ActiveMQ ) and follow recommended setting as mentioned in http://camel.apache.org/jms.html .I setup cacheLevelName to CACHE_NONE , the result is thousands of TIME_WAIT connections crated and approaching the maximum OS  (Windows) ports limit  !!  

im using  camel 2.11 with AMQ 5.8

any Help ?






<bean id="Activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
                <property name="connectionFactory">
                        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                                <property name="brokerURL" value="tcp://10.3.150.132:61001?jms.redeliveryPolicy.maximumRedeliveries=0" />
                                <property name="userName" value="system" />
                                <property name="password" value="manager" />
                        </bean>
                </property>
                <property name="transacted" value="true" />
                <property name="transactionManager" ref="transactionManager" />
                <property name="receiveTimeout" value="250" />
                <property name="cacheLevelName" value="CACHE_NONE" />
        </bean>



 

Othman Darwish
ProgressSoft Corp.
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Claus Ibsen-2
You should use CACHE_CONSUMER if you can. Its much faster.

Though some brokers and TX managers does not support it, and thus rely
on CACHE_NONE.
Especially if you use XA transactions.

For single resource transaction with only ActiveMQ then using
CACHE_CONSUMER is safe and supported. And its much faster.


On Sun, Jun 2, 2013 at 3:12 PM, Darwish <[hidden email]> wrote:

> Hi,
>
> im using transacted route which consuming exchanges from JMS component (
> ActiveMQ ) and follow recommended setting as mentioned in
> http://camel.apache.org/jms.html .I setup cacheLevelName to CACHE_NONE , the
> result is thousands of TIME_WAIT connections crated and approaching the
> maximum OS  (Windows) ports limit  !!
>
> im using  camel 2.11 with AMQ 5.8
>
> any Help ?
>
>
>
>
>
>
> <bean id="Activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                 <property name="connectionFactory">
>                         <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                                 <property name="brokerURL"
> value="tcp://10.3.150.132:61001?jms.redeliveryPolicy.maximumRedeliveries=0"
> />
>                                 <property name="userName" value="system" />
>                                 <property name="password" value="manager" />
>                         </bean>
>                 </property>
>                 <property name="transacted" value="true" />
>                 <property name="transactionManager" ref="transactionManager" />
>                 <property name="receiveTimeout" value="250" />
>                 <property name="cacheLevelName" value="CACHE_NONE" />
>         </bean>
>
>
>
>
>
>
>
>
>
> -----
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transactions-and-Cache-Levels-tp5733618.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Darwish
Thanks Claus .. that's clear for me  ..one more question please ... can i use
org.springframework.orm.jpa.JpaTransactionManager as transaction manager instead of  jms transaction manager ... my case is

from AcitveMQ:myqueue
transacted =true
to    myCustomCamelComponent

my myCustomCamelComponent is acts as gateway to external system which interact with database (read/write)  .. i think i need to XA transaction ..can you recommend a provider ?





Othman Darwish
ProgressSoft Corp.
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Claus Ibsen-2
If you have a copy of Camel in Action, then read chapter 9, its all
about transactions.

XA is much more complex and often slower. And the fact there is few XA
TX managers out there. And how well are they really? And the idea of
not ever loosing a message and that 2+ different IT systems can 100%
be in consistent state, is IMHO a nirvana.

Often its better avoiding XA and rely on the fact if you could write
the to JDBC database (eg no exception was thrown) and it was the last
step in the route, then you can also commit the JMS TX. As you already
was reading from the JMS to start the route.

Anyway in theory you need XA. But I would avoid using it at all cost.
Or use it seldom.

If you build systems where you can reply messages then its often
easier and a better design. You would then need to use some
duplication detection or have JDBC operations that has no side effect
if the same message is replayed.



On Sun, Jun 2, 2013 at 5:42 PM, Darwish <[hidden email]> wrote:

> Thanks Claus .. that's clear for me  ..one more question please ... can i use
> org.springframework.orm.jpa.JpaTransactionManager as transaction manager
> instead of  jms transaction manager ... my case is
>
> from AcitveMQ:myqueue
> transacted =true
> to    myCustomCamelComponent
>
> my myCustomCamelComponent is acts as gateway to external system which
> interact with database (read/write)  .. i think i need to XA transaction
> ..can you recommend a provider ?
>
>
>
>
>
>
>
>
>
> -----
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transactions-and-Cache-Levels-tp5733618p5733625.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Christian Mueller
Administrator
In reply to this post by Darwish
As mentioned at [1], you should use the PooledConnectionFactory.

[1] http://camel.apache.org/activemq.html

Best,

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Sun, Jun 2, 2013 at 3:12 PM, Darwish <[hidden email]>wrote:

> Hi,
>
> im using transacted route which consuming exchanges from JMS component (
> ActiveMQ ) and follow recommended setting as mentioned in
> http://camel.apache.org/jms.html .I setup cacheLevelName to CACHE_NONE ,
> the
> result is thousands of TIME_WAIT connections crated and approaching the
> maximum OS  (Windows) ports limit  !!
>
> im using  camel 2.11 with AMQ 5.8
>
> any Help ?
>
>
>
>
>
>
> <bean id="Activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                 <property name="connectionFactory">
>                         <bean
> class="org.apache.activemq.ActiveMQConnectionFactory">
>                                 <property name="brokerURL"
> value="tcp://10.3.150.132:61001?jms.redeliveryPolicy.maximumRedeliveries=0
> "
> />
>                                 <property name="userName" value="system" />
>                                 <property name="password" value="manager"
> />
>                         </bean>
>                 </property>
>                 <property name="transacted" value="true" />
>                 <property name="transactionManager"
> ref="transactionManager" />
>                 <property name="receiveTimeout" value="250" />
>                 <property name="cacheLevelName" value="CACHE_NONE" />
>         </bean>
>
>
>
>
>
>
>
>
>
> -----
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Transactions-and-Cache-Levels-tp5733618.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Christian Mueller
Administrator
In reply to this post by Darwish
May be this sample is also useful for you:
https://github.com/muellerc/camel-in-transaction

Best,

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Sun, Jun 2, 2013 at 5:42 PM, Darwish <[hidden email]>wrote:

> Thanks Claus .. that's clear for me  ..one more question please ... can i
> use
> org.springframework.orm.jpa.JpaTransactionManager as transaction manager
> instead of  jms transaction manager ... my case is
>
> from AcitveMQ:myqueue
> transacted =true
> to    myCustomCamelComponent
>
> my myCustomCamelComponent is acts as gateway to external system which
> interact with database (read/write)  .. i think i need to XA transaction
> ..can you recommend a provider ?
>
>
>
>
>
>
>
>
>
> -----
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Transactions-and-Cache-Levels-tp5733618p5733625.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Transactions and Cache Levels

Darwish
Yes cluas .. XA is evil  , i will  simplify my route design and make sure that the JDBC operation is last step in my route

Christian ..thank you for sample .. im reviewing the jmsAndJdbc  sample:

 from("activemqTx:queue:transaction.incoming.one")

                    .transacted("PROPAGATION_REQUIRED_JMS")

                    .transacted("PROPAGATION_REQUIRED_JDBC")

                    .to("sql:UPDATE account SET balance = (SELECT balance from account where name = 'foo') - # WHERE name = 'foo'?dataSourceRef=dataSource")
                    .to("sql:UPDATE account SET balance = (SELECT balance from account where name = 'bar') + # WHERE name = 'bar'?dataSourceRef=dataSource")
                    .to("activemqTx:queue:transaction.outgoing.one");



there is two transaction manager JMS and JDBC in same route which is something new for me :)  and i think it should be considered before going to XA option

Othman Darwish
ProgressSoft Corp.