This content has been marked as final.
Show 3 replies
-
1. Re: calling consumer.receive() doesn't delete the message
jbertram Apr 23, 2014 12:50 PM (in response to yairogen)Can you share you're client code?
-
2. Re: Re: calling consumer.receive() doesn't delete the message
yairogen Apr 23, 2014 2:18 PM (in response to jbertram)This code prints the same message no matter how many times I tun it.
ClientSessionFactory nettyFactory = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName())).createSessionFactory(); ClientSession session = nettyFactory.createSession(true,true); session.start(); ClientConsumer consumer = session.createConsumer("example"); ClientMessage msgReceived = consumer.receive(); System.out.println("message = " + msgReceived.getBodyBuffer().readString()); session.close();
-
3. Re: Re: Re: calling consumer.receive() doesn't delete the message
jbertram Apr 23, 2014 2:39 PM (in response to yairogen)You aren't acknowledging the message. You have to call org.hornetq.api.core.client.ClientMessage.acknowledge() to remove the message from the server.
Furthermore, when you call:
ClientSession session = nettyFactory.createSession(true,true);
You are creating a session that will auto-commit sends and acks. In other words, you don't have to call org.hornetq.api.core.client.ClientSession.commit() to complete a send or acknowledgement. However, for acknowledgements you still have to call acknowledge().