Queue::Q4Pg::Lite is a Perl module that offers a simple message queue using PostgreSQL, which supports pg_advisory_lock (version 8.2 or later).
This algorithms was invented by http://d.hatena.ne.jp/n_shuyo/20090415/mq .
Many codes copied from Queue::Q4M.
SYNOPSIS
use Queue::Q4Pg::Lite;
my $q = Queue::Q4Pg::Lite- >connect(
connect_info = > [
'dbi:Pg:dbname=mydb',
$username,
$password
],
);
for (1..10) {
$q- >insert($table, \%fieldvals);
}
while ($q- >next($table)) {
my $cols = $q- >fetch_hashref()
print "col1 = $cols- >{col1}, col2 = $cols- >{col2}, col3 = $cols- >{col3}\n";
$q- >ack;
}
$q- >disconnect;
# Table schema requires id column.
CREATE TABLE mq ( id SERIAL PRIMARY KEY, message TEXT );
Product's homepage
Requirements:
· Perl