-
1. Re: how to - session creation flags and auto commit acks
clebert.suconic Oct 21, 2010 5:56 PM (in response to rajks)1 of 1 people found this helpfulI - A session is supposed to be a single theaded object. you're not supposed to do the acknowledgement or commit in another thread.
II - Since you created the session with auto-commit-ack=false, you're supposed to call commit at some point.
-
2. Re: how to - session creation flags and auto commit acks
rajks Oct 21, 2010 9:46 PM (in response to clebert.suconic)Thanks for the help
I tried to acknowledge in the consumer thread itself and it works it seems to be working.
But I started getting this exception
Oct 21, 2010 6:43:24 PM org.hornetq.core.logging.impl.JULLogDelegate error
SEVERE: Caught unexpected exception
java.lang.IllegalStateException: 1593275665 Could not find reference on consumerID=0, messageId = 25 queue = queue.debug closed = false
at org.hornetq.core.server.impl.ServerConsumerImpl.acknowledge(ServerConsumerImpl.java:512)
at org.hornetq.core.server.impl.ServerSessionImpl.acknowledge(ServerSessionImpl.java:513)
at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:290)
at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:471)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:451)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:412)
at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:459)
at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:67)
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:362)
at org.jboss.netty.channel.StaticChannelPipeline$StaticChannelHandlerContext.sendUpstream(StaticChannelPipeline.java:514)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287)
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169)
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:362)
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:357)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:90)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Oct 21, 2010 6:43:24 PM org.hornetq.core.logging.impl.JULLogDelegate errorIs that any configuration settings error or doing something wrong.
Thanks
Raj
-
3. Re: how to - session creation flags and auto commit acks
clebert.suconic Oct 21, 2010 9:52 PM (in response to rajks)you are probably double Acking.
-
4. Re: how to - session creation flags and auto commit acks
rajks Oct 21, 2010 10:17 PM (in response to clebert.suconic)I verified that I am not acknowleding more than once.
The only thin I am doing is receiving the messages and I acknowledge ODD ID messages and keep the even messages in memory to similate a retry condition internally.
Once retried in memory for 3 times I acknowledge all the EVEN ID messages in the same session thread.
This is when I get the exception I posted earlier. I have not restarted the process at all.
What should be done correctly here ??
-
5. Re: how to - session creation flags and auto commit acks
clebert.suconic Oct 22, 2010 12:25 AM (in response to rajks)1 of 1 people found this helpfulWhenver you ACK the last message, you're acknowledging all the previous messages...
So, you are double acking indeed.
say, you received:
msg1,
msg2,
msg3
when you do msg3.ack...
you are acking 1 and 2 automatically.
This is the semantic implemented. It's similar to JMS semantics on ACKing.
-
6. Re: how to - session creation flags and auto commit acks
rajks Oct 22, 2010 12:32 AM (in response to clebert.suconic)Thanks for getting me to this point.
Is there any other option available for my use case ??
If not do I have to do the ack management in our app layer and batch process it ???