Queue Tables

Database
Enthusiast

Queue Tables

I'm new to queue tables and have been researching on what they can do.

Is it possible to have records in a queue table that are assessed on their status before being consumed?

For example you set up a queue table with stock purchased. Say 3 records each of a  quantity received of 100 each on different dates.

If theere are 2 stock sales, say the first was 100 then the second sale was 50, is there a way to consume the first stock record but save the consumption of the second stock record until the remaing 50 stock balance is sold?

My research says its all or nothing. You cannot stall consumption.

Tags (1)
1 REPLY
Junior Contributor

Re: Queue Tables

You're probably correct.

There's no WHERE-clause for SELECT AND CONSUME.

When you SELECT AND CONSUME a row it's deleted from the queue. You might re-insert it but it will be consumed again immediately.

You can simply SELECT from the queue without deleting it, but then you would need a loop within your process accessing the queue table every x seconds/minutes (and this is similar to not using a queue table at all).