camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sunderb <sunder_raman_bala...@dellteam.com>
Subject Limit number of JMS Processor
Date Fri, 16 Sep 2011 18:30:53 GMT
Hi

We are connecting to weblogic JMS queue - through a standalone camel
application - Using the below camelContext file. The idea is to check for
pending message in JMS queue and process them one after the other. We would
like to limit the number of processors processing at one instance of time.
Do we need to adjust default thread pool for the same?

Thanks
sunder

 <threadPoolProfile id="defaultThreadPoolProfile" defaultProfile="true"
                       poolSize="10" maxPoolSize="20" maxQueueSize="1000"
                       rejectedPolicy="CallerRuns"/>



<?xml version="1.0" encoding="UTF-8"?>
<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"
       xmlns:broker="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
        http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">

        
 	
    
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>


	  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
	      <route>
	          <from uri="weblogic:queue:jms/xxincqueue"/>
	          <process ref="iIncrementalDBChangeProcessor"/>
	      </route>
	  </camelContext>



    <bean id="weblogic" class="org.apache.camel.component.jms.JmsComponent">
      <property name="connectionFactory" ref="weblogicConnectionFactory"/>
      <property name="destinationResolver"
ref="weblogicDestinationResolver"/>
    </bean>

    <bean id="weblogicDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
      <property name="jndiTemplate" ref="remoteJndi" /> 
    </bean>

    <bean id="weblogicConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiTemplate" ref="remoteJndi" />
      <property name="jndiName" value="jms/xxincqcf" />
    </bean>

    <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate"> 
      <property name="environment"> 
          <props> 
              <prop
key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop> 
              <prop
key="java.naming.provider.url">t3://yyhost01.us.dell.com:9001</prop> 
          </props>
      </property> 
     </bean>   


	<bean id="iIncrementalDBChangeProcessor"
class="com.xx.listener.IncrementalDBChangeProcessor"/>

</beans>

public class IncrementalDBChangeProcessor implements Processor {
	private static int count = 0;
	private static Logger logger = Logger
	.getLogger(IncrementalDBChangeProcessor.class);	
    public void process(Exchange e) {
        String message = (String) e.getIn().getBody();

        DataMapperUtility dDataBeanMapper = new DataMapperUtility();
        Object oBeanObject = dDataBeanMapper.mapToBean(message);
        count++;

    }
}

public class WLJMSListener {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
        // START SNIPPET: e1
    	ApplicationContext context = new
ClassPathXmlApplicationContext("weblogic-listener-camelContext.xml");
        CamelContext camel = (CamelContext) context.getBean("camel");
        
                
        camel.start();
	}

}


--
View this message in context: http://camel.465427.n5.nabble.com/Limit-number-of-JMS-Processor-tp4811575p4811575.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message