Search code examples
javajmsoracle-aq

JMS Push Consumer delay in getting message from Oralce AQ


I have an application where I have implemented Oracle AQ. I noticed that there is a delay of few seconds in consumption of message by JMS Push consumer, after message has been produced to AQ.

I ran this scenario where I produced a few messages in to AQ like 10 messages in an hour. I noticed that there was a few seconds delay in consumption of message. I calculated average delay time in such scenario and it came out to be 12 seconds and maximum delay time came out to be 13.5 seconds.

But when I increased my rate of production to 1000 messages in an hour. I saw less delay in consumption. and I got an constant average of 5 seconds, with maximum delay of 5.2 seconds.

I can assume that there might be some sleep time for JMS consumer thread But I'm bit confused as I'm using Push consumer instead of Poll consumers.

Please help me to find out reason for such delay and how can I shorten this gap of time.

~Thanks


Solution

  • On enabling (-Doracle.jms.traceLevel=6) diagnostics logs for aq api.

    AQjmsListenerWorker goes for sleep if message is not available for consumption and sleep time doubles each time (up to peak limit) if message is not available for consumption.

    Analyzed that Listener thread sleep time doubles till 15000 ms (15 sec), starting with default value 1000 ms, if null message is received from AQ.

    To reduce the sleep time set following system properties:

    oracle.jms.minSleepTime=100
    oracle.jms.maxSleepTime=4000
    

    Further details please refer: http://querydb.blogspot.in/2014/10/jms-consumer-onmessage-delay-in-getting.html