JMS client receives AQ messages asynchronously with a delay of 15 seconds
2907631May 7 2013 — edited Nov 22 2018I have written a stand alone (Java SE 1.6) JMS client program to consume AQ's messages via Oracle JMS API (aqapi.jar). The queue is a multiple consumer queue, and i just created one subscriber on it. My JMS client program receives messages asynchronously by setting the MessageListener using the setMessageListener method.
Watching the work of the program, I found significant delays in receiving messages that are up to several seconds. When I turned on the diagnostic trace, I found that in the absence of messages listener (AQjmsSimpleScheduler) gradually increases the delay time up to 15 seconds:
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsSimpleScheduler.feedData: Got a non null message, the sleep time is reset to 0
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.run: sleep 0 millisecond.
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 1000
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.run: sleep 1000 millisecond.
Thread-1 [Mon May 06 22:14:23 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 1000 milliseconds
Thread-1 [Mon May 06 22:14:24 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 2000
Thread-1 [Mon May 06 22:14:24 MSK 2013] AQjmsListenerWorker.run: sleep 2000 millisecond.
Thread-1 [Mon May 06 22:14:24 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 2000 milliseconds
Thread-1 [Mon May 06 22:14:26 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 4000
Thread-1 [Mon May 06 22:14:26 MSK 2013] AQjmsListenerWorker.run: sleep 4000 millisecond.
Thread-1 [Mon May 06 22:14:26 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 4000 milliseconds
Thread-1 [Mon May 06 22:14:30 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 8000
Thread-1 [Mon May 06 22:14:30 MSK 2013] AQjmsListenerWorker.run: sleep 8000 millisecond.
Thread-1 [Mon May 06 22:14:30 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 8000 milliseconds
Thread-1 [Mon May 06 22:14:38 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 15000
Thread-1 [Mon May 06 22:14:38 MSK 2013] AQjmsListenerWorker.run: sleep 15000 millisecond.
Thread-1 [Mon May 06 22:14:38 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 15000 milliseconds
Thread-1 [Mon May 06 22:14:53 MSK 2013] AQjmsSimpleScheduler.feedData: Got a null message, the sleep time is doubled to 15000
Thread-1 [Mon May 06 22:14:53 MSK 2013] AQjmsListenerWorker.run: sleep 15000 millisecond.
Thread-1 [Mon May 06 22:14:53 MSK 2013] AQjmsListenerWorker.doSleep: try to wait for 15000 milliseconds
Thus, in the worst case, the delay between placing the message in the queue and receiving it by the JMS client is 15 seconds.
Can I control this latency? For example, I would like to explicitly set the levels of the time delays. Have any ideas?
Thank you very much for your advices.