[SR-Users] Question about mqueue

Alex Balashov abalashov at evaristesys.com
Mon Oct 11 11:25:22 CEST 2010


First, thank you, Ramona, for implementing 'mqueue', and the 
development team more generally.  I got away from 'acc' over the 
weekend and how use mqueue + rtimer + sqlops for asynchronous CDR 
logging.  Classy!

The question is, there a clean, fast way of checking whether there are 
more items left in the queue to consume?

I would have thought mq_fetch() would return when there's nothing else 
left in the queue, but it doesn't;  instead, it throws the script into 
an infinite loop.  :-)  So, I am using:

    route[RECORD_CONSUMER] {
       while(mq_fetch("somequeue")) {

         if(! defined $mqk(somequeue))
            break;

          # Do things with $mqk(...) and $mqv(...)

       }
    }

Is 'defined' a fast-acting operator within route script?  Is there a 
better way?

-- 
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list