Hello!

I am trying to use concurrent processing with Spring-configurated Camel.

After some time on heavy load,  exception
"com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure" appears. Maximum of connections per user
in MySQL is set to 100.

Without <property name="concurrentConsumers" value="1"/>, <property
name="maxConcurrentConsumers" value="5"/> everything is okay.

Any ideas?

configuration file:

    <context:annotation-config/>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <bean id="orderProcessor" class="com.itb.rfq.oms.OrderProcessor"
scope="prototype"/>

    <bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="nio://localhost:61616"/>
        <property name="concurrentConsumers" value="1"/>
        <property name="maxConcurrentConsumers" value="5"/>
    </bean>

    <camelContext xmlns="http://camel.apache.org/schema/spring";>
        <package>com.oms</package>
        <route>
            <from uri="jms:queue:web-oms"/>
            <bean ref="orderProcessor" method="processOrder"/>
            <to uri="jms:queue:oms-router"/>
        </router>
    </camelContext>

  <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="jpaVendorAdapter">
            <bean
class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
                <property name="showSql" value="false"/>
                <property name="generateDdl" value="true"/>
                <property name="database" value="MYSQL"/>
            </bean>
        </property>
        <property name="jpaProperties">
            <props>
                <prop key="toplink.weaving">static</prop>
                <prop key="toplink.logging.level">WARNING</prop>
                <prop key="toplink.ddl-generation">create-tables</prop>
            </props>
        </property>
    </bean>

    <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
        <property name="transactionManager" ref="transactionManager"/>
    </bean>

    <bean id="dataSource"
class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
        <property name="url" value="jdbc:mysql://localhost:3306/itb_rfq"/>
        <property name="user" value="root"/>
        <property name="password" value="123456"/>
    </bean>

    <bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>


Processor class:
public class OrderProcessor {

    @PersistenceContext
    private EntityManager manager;

    @Transactional
    public void processOrder(Order order) {
        manager.persist(order);
    }
...
}

Thanks in advance,

Eugene

Reply via email to