4 Replies Latest reply on Jun 17, 2013 10:37 PM by cy zhong

    hornerq InVM acknowledge

    cy zhong Newbie

      hi  ,

      i have a question about HornetQ InVM acknowledge :

      I modifid the hornetQ source codes, i want to use ClientConsumer(have successful init) to get msg in the local HornetQ using InVM and use JMS producer to send msg to the remote JMSServer.


      1: init the object

      localClientSessionFactory = locator.createSessionFactory(); 

      localClientSession = localClientSessionFactory.createSession(false, false, 0)  //

      localClientConsumer = localClientSession.createConsumer(recv_corequeue);


      2:modify the JMSBridge function:SourceReceiver

      In the "Run" function of the "SourceReceiver" class, i modyfy as this:

      cmsg = localClientConsumer.receive(1000); 

      if (cmsg != null)


           hq_msg = HornetQMessage.createMessage(cmsg, localClientSession);


           //cmsg.acknowledge();       do ack after send

           msg = hq_msg;


      but after 2 hours runing, the VM memary is Overflow.

      but i find a anusual circumstances:

      step 1:i clean the HornetQ Datadir where is store the msg data.

      step 2:run the HornetQ, the JMSBridge have inited , JMSBridge Binded the queue1 in the local HornerQ and JMSBridge connected to the remote JMSServer .

      step 3:send 1000 msgs to the local HornerQ's queue1, and the 1000 msgs are transferred to the remote JMSServer , i can see the 1000 msgs have already existed. and just 1000 msgs.

      step 4:i shot down the local HornerQ and remote JMSServer, just clean the remote JMSServer data.

      step 5:run local HornerQ and remote JMSServer again without sending msg, but the Bridge send msg to the remote JMSServer as before, and the msg count is 1000.

      So, i think, the msg still in the HornetQ in the "step 3", so the VM memary is Overflow with a long time runing.

      how can i ack the msg after recving the msg by the localClientConsumer? is there something wrong in my code?