activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ManojC <ma...@castiron.com>
Subject Re: receiveNoWait() return null even if there are messages in queue
Date Fri, 27 Mar 2009 16:42:54 GMT

Attached is the program which can be used to reproduce the issue. This uses
the .binding files to interact with ActiveMQ.
http://www.nabble.com/file/p22745175/TestAMQGetMsg.java TestAMQGetMsg.java 

ManojC wrote:
> 
> One more thing I noticed in the stack is that there is thread in MQ which
> never finishes even though the main function is done Below is the stack.
> "ActiveMQ Transport: tcp:///10.10.15.156:61616" prio=6 tid=0x0b1e1000
> nid=0x1078 runnable [0x0b83f000..0x0b83fb14]
>    java.lang.Thread.State: RUNNABLE
> 	at java.net.SocketInputStream.socketRead0(Native Method)
> 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
> 	at
> org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
> 	at
> org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
> 	at java.io.DataInputStream.readInt(DataInputStream.java:370)
> 	at
> org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at
> org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:619)
> 
> ManojC wrote:
>> 
>> Hi
>> We are using JAVA Program standalone to poll activeMQ queues. The way we
>> do is following we go and try to get the message using
>> consumer.receive(timeout) call and if the it receives the message we use
>> while loop to get more messages if they are in the queue. The sample code
>> of what we do is attach here 
>> 
>> Message msg = consumer.receiveMsg(30*1000) //timeout can be configured.
>> //do some processing here to send the message to the destination system.
>> 
>> While(msg != null) {
>> //do some processing here to send the message to the destination system.
>> }
>> 
>> Now the problem is if I put say 1000 message in the queue sometime it
>> picks 1 message some time it picks 200 message... the number are random
>> it seems there some issue in receiveNoWait call which causes it to return
>> null prematurely.
>> 
>> Seems like a bug in the ActiveMQ we are using ActiveMQ 5.2 version
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/receiveNoWait%28%29-return-null-even-if-there-are-messages-in-queue-tp22733573p22745175.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message