Net::Kestrel - Kestrel Client for Perl
use Net::Kestrel; my $queuename = 'myqueue'; my $kes = Net::Kestrel->new; # defaults to host => 127.0.0.1, port => 2222 $kes->put($queuename, 'foobar'); # ... later # take a peek, doesn't remove the item my $item = $kes->peek($queuename); # get the item out, beginning a transaction my $real_item = $kes->get($queuename); # ... do something with it # then confirm we finished it so kestrel can discard it $kes->confirm($queuename, 1); # since we got one item
Net::Kestrel is a text protocol client for https://github.com/robey/kestrel.
The ip address of the Kestrel host you want to connect to.
The port to connect to. Defaults to 2222.
The timeout value for operations. Defaults to 3 seconds.
Confirms $count items from the queue.
Delete the specified queue.
Flush (empty) the specified queue.
Gets an item from the queue. Note that this implicitly begins a transaction and the item must be
confirmed or kestrel will give the item to another client when you disconnect. Optionally you may provide a timeout (in milliseconds). Net::Kestrel will block for that long waiting for a value in the queue.
Peeks into the specified queue and "peeks" at the next item. Optionally you may provide a timeout (in milliseconds). Net::Kestrel will block for that long waiting for a value in the queue.
Puts the provided payload into the specified queue.
Returns stats from the kestrel instance
This module is brand new and is likely missing features.
Net::Kestrel speaks Kestrel's text protocol only at present.
Kestrel returns errors in the form of:
When any command returns a string like this, Net::Kestrel will die with that message. Therefore you should
eval any methods you care to deal with errors for.
Cory G Watson <firstname.lastname@example.org>
This software is copyright (c) 2011 by Infinity Interactive, Inc.