Streaming Consumer Receives Only 1 Message With 0 Client Buffer
aengineer Jul 14, 2010 2:55 PMA streaming JMS consumer fails to receive more than 1 message if the client side buffer is set to 0 (via setting '<consumer-window-size>0</consumer-window-size>' in the hornetq-jms.xml file).
For more details on why we set the client side buffer to 0, please refer to http://community.jboss.org/thread/153426.
If you stream N large messages to the JMS server, and then you try to receive these N large messages, you will only get back a single message before the receiver times out. The receiver is essentially
doing a "consumer.receive(NNN)". The HQ server side log file captures the below stack trace.
To reproduce this issue, you can use the HQ sample app itself (examples/jms/large-message). Simply change the code to send more than 1 message and to receive all published messages. A modified copy of the original source, which will
publish and attempt to receive 10 messages is attached. If you update 'server0/hornetq-jms.xml' and set the client buffer to 0, you should experience the same behavior.
Stack trace from hornetq.log when attempting to receive N large messages using streaming API.
[main] 16:27:50,399 INFO [org.hornetq.core.server.impl.HornetQServerImpl] HornetQ Server version 2.1.0.CR1 (auraria, 118) started
[Old I/O server worker (parentId: 12073952, channelId: 28880561, null => richmond2.putnaminv.com/172.20.91.67:5142)] 16:29:58,616 SEVERE [org.hornetq.core.protocol.core.ServerSessionPacketHandler] Caught unexpected exception
java.lang.NullPointerException
at org.hornetq.core.server.impl.ServerConsumerImpl.receiveCredits(ServerConsumerImpl.java:470)
at org.hornetq.core.server.impl.ServerSessionImpl.receiveConsumerCredits(ServerSessionImpl.java:955)
at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:454)
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.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
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.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
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:619)
Thanks
Aspi Engineer
Putnam Investments
-
LargeMessageExample.java.zip 2.9 KB