Hi ,
I tried to use BatchMessageListenerContainer  with camel still it is picking
up single message from queue per transaction, could you please let me know
what I am doing wrong here.
Here is my code snippet 

 Look like BatchMessageListenerContainer   not deployed in Maven central.

 I have copied source code  from spring-batch-infrastructure-tests module
And setup TransactionInterceptor and RepeatOperationsInterceptor as per
there documentation 

<bean id="transactionInterceptor"  class="org....TransactionInterceptor">
        <property name="transactionManager" ref="jtaTransactionManager" />
        <property name="transactionAttributes" value="*=PROPAGATION_REQUIRED" />
</bean>
<bean id="repeatOperationsInterceptor"
class="org.....RepeatOperationsInterceptor">
                <property name="repeatOperations" ref="batchTemplate" />
</bean>
<bean id="batchTemplate" class="org.....RepeatTemplate">
                <property name="completionPolicy">
                        <bean
class="org.springframework.batch.repeat.policy.SimpleCompletionPolicy">
                                <constructor-arg value="100" />
                        </bean>
                </property>
 </bean>

I was expecting 100 message per transaction .....

----BatchListenerContainerFactory---

public AbstractMessageListenerContainer createMessageListenerContainer(
                        JmsEndpoint arg0) {
                BatchMessageListenerContainer batchMessageListenerContainer=new
BatchMessageListenerContainer();
                
batchMessageListenerContainer.setTransactionManager(transactionManager);
                
batchMessageListenerContainer.setConnectionFactory(connectionFactory);
                
batchMessageListenerContainer.setMessageListener(messageListener);
                
batchMessageListenerContainer.setDestinationName(destinationName);
                batchMessageListenerContainer.setConcurrentConsumers(1);
                batchMessageListenerContainer.setReceiveTimeout(3000);
                batchMessageListenerContainer.setSessionTransacted(true);
                Advice[] advices = new Advice[2];
                advices[0]=transactionInterceptor;
                advices[1]=repeatOperationsInterceptor;
                batchMessageListenerContainer.setAdviceChain(advices);
                                return batchMessageListenerContainer;
        }

------Camel root----
<camel:from
uri="jms:queue:queue.incomingEvents?messageListenerContainerFactoryRef=#batchListenerContainerFactory&amp;transacted=true"
/>
<transacted ref="PROPAGATION_REQUIRES_NEW" />
<camel:to uri="stream:out"/>
            
regards,
pp




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-improve-throughput-by-grouping-messages-in-a-Transaction-tp5773344p5774390.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to