App-Basis-Queue

 view release on metacpan or  search on metacpan

lib/App/Basis/Queue.pm  view on Meta::CPAN


Hashref of the data to be published

=item persist (optional)

Flag to show that this data data should be persisited (0 or 1).
This will become the only persistent record available until either it is replaced or expires.

=item expires (optional)

Time after which this data should be ignored. Accepts unix epoch time or parsable datetime string

=back

B<Example usage>

    my $queue = App::Basis::Queue->new( dbh => $dbh) ;

    # keep track of a bit of info
    $queue->publish( queue => 'app_log',
        data => {

lib/App/Basis/Queue.pm  view on Meta::CPAN


    foreach my $row ( @{ $result->{rows} } ) {
        $row->{data} = decode_json( $row->{data} ) ;    # unpack the data
        CORE::push @data, $row ;
    }

    return \@data ;
}

# -----------------------------------------------------------------------------
# get chatter data (ordered by datetime added) after a unix time
# queue is the only parameter,
# returns arrayref of items

sub _recent_chatter
{
    my $self = shift ;
    my $params = @_ % 2 ? shift : {@_} ;

    if ( ref($params) ne 'HASH' ) {
        warn "_recent_chatter accepts a hash or a hashref of parameters" ;

lib/App/Basis/Queue.pm  view on Meta::CPAN

=item queue

Name of the queue, wildcard allowed

=item callback

Coderef to handle any matched events

=item after (optional)

Unix time after which to listen for events, defaults to now,  if set will skip persistent item checks

=item persist (optional)

Include the most recent persistent item, if using a wild card, this will match all the queues and could find multiple persistent items

=back

B<Example usage>

    my $queue = App::Basis::Queue->new( dbh => $dbh) ;

lib/App/Basis/Queue.pm  view on Meta::CPAN

Hash of

=over

=item events (optional)

Minimum number of events to listen for, stop after this many,  may stop after more - this is across ALL the subscriptions

=item datetime (optional)

Unix epoch time or parsable datetime when to stop listening

=item persist (optional)

Include the most recent persistent item, if subscribed using using a wild card,
this will match all the queues and could find multiple persistent items

=item listen_delay (optional)

Override the class delay, obtain events at this rate

lib/App/Basis/Queue.pm  view on Meta::CPAN

Hash of

=over

=item queue

Name of the queue, wildcard allowed

=item before (optional)

Unix epoch or parsable datetime before which items should be purged

defaults to 'now'

=back

B<Example usage>

    my $before = $queue->stats( queue => 'queue_name', before => '2015-11-24') ;
    $queue->purge_tasks( queue => 'queue_name') ;
    my $after = $queue->stats( queue  => 'queue_name') ;

lib/App/Basis/Queue.pm  view on Meta::CPAN

Hash of

=over

=item queue

Name of the queue, wildcard allowed

=item before (optional)

Unix epoch or parsable datetime before which items should be purged

defaults to 'now'

=back

B<Example usage>

    my $del = $queue->purge_chatter( queue => 'queue_name', before => '2015-11-24') ;

    say "removed $del messages" ;



( run in 3.366 seconds using v1.01-cache-2.11-cpan-64ef6c95b5d )