I am working on a live Production issue with HornetQ Queue issue.
Following is the stack for my application
Wildfly 9.0.2
HornetQ 2.4.7
Spring 4.3
I am using netty connection for hornetq, in wildfly, following is the configuration in
standalone-full.xml
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="RemoteConnectionFactory"/>
<entry name="java:jboss/exported/RemoteConnectionFactory"/>
</entries>
<block-on-non-durable-send>false</block-on-non-durable-send>
<block-on-durable-send>false</block-on-durable-send>
<consumer-window-size>0</consumer-window-size>
</connection-factory>
Spring configuration is as follow.
<bean id = "atfQueueMDP" class = "org.springframework.jms.listener.DefaultMessageListenerContainer" >
<property name = "concurrentConsumers" value = "20"/>
<property name = "connectionFactory" ref = "connectionFactory"/>
<property name = "destination" ref = "atfQueue"/>
<property name = "messageListener" ref = "messageListener"/>
<property name = "sessionAcknowledgeMode" value = "2"/>
</bean>
<bean id="connectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
<constructor-arg value="false"/>
<constructor-arg>
<bean name="transportConfiguration" class="org.hornetq.api.core.TransportConfiguration">
<constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.Object">
<entry key="host" value="localhost" />
<entry key="port" value="5445" />
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean id = "ATFJmsTemplate" class = "org.springframework.jms.core.JmsTemplate">
<property name = "connectionFactory">
<ref bean = "connectionFactory"/>
</property>
<property name = "sessionAcknowledgeMode" value = "2"/>
<property name = "receiveTimeout">
<value>-1</value>
</property>
</bean>
<bean id = "atfQueue" class = "org.springframework.jndi.JndiObjectFactoryBean" >
<property name = "jndiTemplate">
<ref bean = "jndiTemplate"/>
</property>
<property name = "jndiName">
<value>queue/ATFQueue</value>
</property>
</bean>
<bean id = "messageListener" class = "com.example.jms.receiver.ATFReceiver" />
Now the problem is as follow.
I have specify concurrent consumer as 20, So as per my understanding concurrent 20 messages can be processed my listener.
Issue if following condition
- First message is received by client and it is taking around 5 minutes to complete
- Next 19 messages are send and received by remaining 19 consumer then this all get consumed by each consumer, these all complete withing few seconds,let say(10 seconds)
- Now if I send 1 message, but this will not delivered to client as all consumers are busy and it goes into queue, But After completion of above 19th messages all consumers are free, but still last messages is in queue (not get delivered to consumer). This message will only be delivered once first message (of 5 Minute) is complete.
- After completion of 19th message if I send new message then this will be immediately delivered to consumer, but above single message is still in queue.
Can someone please tell me how to solve this issue, that if any consumer free then it should pick up next message immediately.
I have prepared a project through which you can reproduce this scenarios. ProjectDemo
Thanks in advance