11 Replies Latest reply on Jun 23, 2011 12:19 PM by mymykeviv

    Messages remaining in the queue after consuming using core api

    mymykeviv

      I am new to HornetQ so please bear with me.

       

      Let me first tell you my requirnments :

           I need a messages queuing middleware which can pass messages , of about 1k in size, between diffrent process with low latency and persistence(i.e. it should servive system crashes). I would be having multiple processes writing to the same queues and similarly multiple process reading from the same queue.

       

      For this I chose hornetQ as it has the best rating for message passing with persistance.

      I am currently usung Hornetq v2.2.2Final as stand alone server.

      I am able to succesfully create durable/non-durable queues using core api (ClientSession), and successfully post messages to queue (ClientProducer). Similarly I am able to read the messages from the queue using core api (ClientConsumer).

       

      The problem comes after this when the client has read the message, the message still remains in the queue, i.e. the number of messages in the queue remains constant.

      Maybe I am getting this wrong but I was under this impression that once the message is consumed (read + ack), it is removed from the queue.But this is not happening in my case, and the same messages is being read over and over again.

       

      Also, I would like to tell that I have tried using non-durable queues with non-durable messages. but the problem remains.

       

      Thanks in advance.

       

      Attaching sample java files, where :

       

      HQConsumer.java :- It is client consumer class

      HQManager.java  :- It is class to get queue stats

      HQProducer.java :- It is class to for client producer

      HQThreadMon.java :- Thread for monitoring

      HQTestProducer.java :- main class

       

      Message was edited by: Vivek Mehra

       

      Also adding the HornerQ Server config :

       

       

      <configuration xmlns="urn:hornetq"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
      
      
         <paging-directory>${data.dir:../data}/paging</paging-directory>
         
         <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
         
         <journal-directory>${data.dir:../data}/journal</journal-directory>
         
         <journal-min-files>10</journal-min-files>
         
         <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
         
         <connectors>
            <connector name="netty">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
            </connector>
            
            <connector name="netty-throughput">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
               <param key="batch-delay" value="50"/>
            </connector>
         </connectors>
      
      
         <acceptors>
            <acceptor name="netty">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
            </acceptor>
            
            <acceptor name="netty-throughput">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
               <param key="batch-delay" value="50"/>
               <param key="direct-deliver" value="false"/>
            </acceptor>
         </acceptors>
      
      
         <security-settings>
            <security-setting match="#">
               <permission type="createNonDurableQueue" roles="guest"/>
               <permission type="deleteNonDurableQueue" roles="guest"/>
               <permission type="createDurableQueue" roles="guest"/>
               <permission type="deleteDurableQueue" roles="guest"/>
               <permission type="consume" roles="guest"/>
               <permission type="send" roles="guest"/>
            </security-setting>
         </security-settings>
      
      
         <address-settings>
            <!--default for catch all-->
            <address-setting match="#">
               <dead-letter-address>jms.queue.DLQ</dead-letter-address>
               <expiry-address>jms.queue.ExpiryQueue</expiry-address>
               <redelivery-delay>0</redelivery-delay>
               <max-size-bytes>10485760</max-size-bytes>       
               <message-counter-history-day-limit>10</message-counter-history-day-limit>
               <address-full-policy>BLOCK</address-full-policy>
            </address-setting>
         </address-settings>
      
      
      </configuration>
      
      

       

      Message was edited by: Vivek Mehra