Alagammal P
Alagammal P

Reputation: 909

Spring JMS DefaultMessageListenerContainer - receive n messages per 1 sec

I need to receive 'n' number of messages per every second from IBM MQ. Example : I need to receive maximum 10 messages per second.

I want to use DefaultMessageListnerContainer of spring.

Can this be achieved by setting the below configurations?

<bean id="msgListenerContainer"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer"
        p:connectionFactory-ref="mqConnectionFactory" 
        p:messageListener-ref="myMessageListener"
        p:concurrentConsumers="1" 
        p:maxConcurrentConsumers="10"
        p:receiveTimeout="1000"
        p:maxMessagesPerTask = "10" />

Upvotes: 0

Views: 342

Answers (2)

Matt Pavlovich
Matt Pavlovich

Reputation: 4316

Spring DMLC doesn't have a throttle built in. Apache Camel is another option that is designed for JMS -> throttle -> data processing

Upvotes: 0

Gary Russell
Gary Russell

Reputation: 174759

You might be better using JmsTemplate.receiveAndConvert() instead of a message-driven architecture, if you want to control the rate of message consumption.

Upvotes: 1

Related Questions