I have an application which is similar to classic producer consumer problem. Just wanted to check out all the possible implementations to achieve it. The problem is-
Process A: inserts a row into the table in database (producers)
Process B: reads M rows from the table, deletes the read M rows after processing.
Tasks in process B: 1. Read M rows 2. Process these rows 3. Delete these rows
N1 instances of process A, N2 instances of process B runs concurrently.
Each instance runs on a different box.
Some requirements: If a process p1 is reading (0,M-1) rows. process p2 should not wait for p1 until it releases the lock on these rows, instead it should read (M,2M-1) rows.