0

we have on-premise Service Bus installation. I can publish and subscribe/read messages with QPID AMQP 1.0 0.24 client. However queue browsing doens§t work, the call to hasMoreElements() hangs indefinitely when there are no more messages in the queue. The stack trace is:

Thread [main] (Suspended)   
waiting for: ConnectionEndpoint  (id=19)    
Object.wait(long) line: not available [native method]   
ConnectionEndpoint(Object).wait() line: 503 
Receiver.drainWait() line: 533  
QueueBrowserImpl$MessageEnumeration.hasMoreElements() line: 154 
Qpid.testBrowseTopic(Connection, Context) line: 209 
Qpid.runTest(Qpid$Options) line: 93 
Qpid.main(String[]) line: 63    

The code:

ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("MS_SERVICE_BUS"); connection = connectionFactory.createConnection();

session = connection.createSession(false/*transacted*/, Session.AUTO_ACKNOWLEDGE);

Queue queue = (Queue) context.lookup("MY_QUEUE");

browser = session.createBrowser(queue);

Enumeration<Message> msgs = browser.getEnumeration();

while (msgs.hasMoreElements()) {// hangs when there are no more messages
    Message message = msgs.nextElement();
    //printMessage(message);
}

The same behaviour for QPID 0.22. Is this bug in QPID client or Service Bus?

Thanks, Jan

jan_bar
  • 71
  • 8

1 Answers1

3

There are couple things going on here:

1) Service Bus doesn't support message browse over AMQP at this time. Because the session was created with AUTO_ACKNOWLEDGE, every message you get from the Enumeration is immediately removed from the queue.

2) I have reproduced the hang in hasMoreElements() with QPid 0.25. It appears that hasMoreElements() is waiting for more messages to arrive in the queue, at least at first. If I send more messages, the loop will continue and some of the newly-arrived messages will be returned, but it stops fairly quickly. I am still investigating to determine what's going on there.

  • The messages are removed from the queue even with Session.CLIENT_ACKNOWLEDGE. I think that this mode has effect only when connection.start() and receive() are used. List of not implemented features: [Using Service Bus from .NET with AMQP 1.0](http://msdn.microsoft.com/en-us/library/windowsazure/jj841075.aspx) – jan_bar Feb 10 '14 at 08:58
  • Is this a related issue http://osdir.com/ml/dev-qpid.apache.org/2013-09/msg00417.html ? – Sentinel Feb 12 '14 at 09:22
  • Checked with QPID 0.26 RC4, still hangs. But James told it's not supported at this time so it might be broker problem too. – jan_bar Feb 17 '14 at 09:34
  • Try the same with a different broker. – Sentinel Feb 17 '14 at 14:35