Guillaume Aubert > Queue-DBI-2.1.1 > Queue::DBI::Admin

Download:
Queue-DBI-2.1.1.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v2.1.1   Source   Latest Release: Queue-DBI-v2.6.1

NAME ^

Queue::DBI::Admin - Manage Queue::DBI queues.

VERSION ^

Version 2.1.1

SYNOPSIS ^

        use Queue::DBI::Admin;
        
        # Create the object which will allow managing the queues.
        my $queues_admin = Queue::DBI::Admin->new(
                database_handle => $dbh,
        );
        
        # Create the tables required by Queue::DBI to store the queues and data.
        $queues_admin->create_tables();
        
        # Create a new queue.
        my $queue = $queues_admin->create_queue( $queue_name );
        
        # Test if a queue exists.
        if ( $queues_admin->has_queue( $queue_name ) )
        {
                ...
        }
        
        # Retrieve a queue.
        my $queue = $queues_admin->retrieve_queue( $queue_name );
        
        # Delete a queue.
        $queues_admin->delete_queue( $queue_name );

METHODS ^

new()

Create a new Queue::DBI::Admin object.

        my $queues_admin = Queue::DBI::Admin->new(
                database_handle => $database_handle,
        );

The 'database_handle' parameter is mandatory and must correspond to a DBI connection handle object.

Optional parameters:

        my $queues_admin = Queue::DBI::Admin->new(
                database_handle           => $database_handle,
                queues_table_name         => $custom_queues_table_name,
                queue_elements_table_name => $custom_queue_elements_table_name,
        );

create_tables()

Create the tables required by Queue::DBI to store the queues and data.

        $queues_admin->create_tables(
                drop_if_exist => $boolean,
                sqlite        => $boolean,
        );

By default, it won't drop any table but you can force that by setting 'drop_if_exist' to 1. 'sqlite' is also set to 0 by default, as this parameter is used only for testing.

create_queue()

Create a new queue.

        $queues_admin->create_queue( $queue_name );

has_queue()

Test if a queue exists.

        if ( $queues_admin->has_queue( $queue_name ) )
        {
                ...
        }

retrieve_queue()

Retrieve a queue.

        my $queue = $queues_admin->retrieve_queue( $queue_name );

        # See Queue::DBI->new() for all the available options.
        my $queue = $queues_admin->retrieve_queue(
                $queue_name,
                'cleanup_timeout'   => 3600,
                'verbose'           => 1,
                'max_requeue_count' => 5,
        );

delete_queue()

Delete a queue and all associated data, permanently. Use this function at your own risk!

        $queues_admin->delete_queue( $queue_name );

INTERNAL METHODS ^

get_database_handle()

Returns the database handle associated with the Queue::DBI::Admin.

        my $database_handle = $queue->get_database_handle();

get_queues_table_name()

Returns the name of the table used to store queue definitions.

        my $queues_table_name = $queue->get_queues_table_name();

get_queue_elements_table_name()

Returns the name of the table used to store queue definitions.

        my $queue_elements_table_name = $queue->get_queue_elements_table_name();

AUTHOR ^

Guillaume Aubert, <aubertg at cpan.org>.

BUGS ^

Please report any bugs or feature requests to bug-queue-dbi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Queue-DBI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

        perldoc Queue::DBI::Admin

You can also look for information at:

ACKNOWLEDGEMENTS ^

Thanks to Sergey Bond for suggesting this administration module to extend and complete the features offered by Queue::DBI.

COPYRIGHT & LICENSE ^

Copyright 2009-2012 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/

syntax highlighting: