1Queue::DBI::Element(3)User Contributed Perl DocumentationQueue::DBI::Element(3)
2
3
4

NAME

6       Queue::DBI::Element - An object representing an element pulled from the
7       queue.
8

VERSION

10       Version 2.7.0
11

SYNOPSIS

13       Please refer to the documentation for Queue::DBI.
14

METHODS

16   new()
17       Create a new Queue::DBI::Element object.
18
19               my $element = Queue::DBI::Element->new(
20                       'queue'         => $queue,
21                       'data'          => $data,
22                       'id'            => $id,
23                       'requeue_count' => $requeue_count,
24                       'created'       => $created,
25               );
26
27       All parameters are mandatory and correspond respectively to the
28       Queue::DBI object used to pull the element's data, the data, the ID of
29       the element in the database and the number of times the element has
30       been requeued before.
31
32       It is not recommended for direct use. You should be using the following
33       to get Queue::DBI::Element objects:
34
35               my $queue = $queue->next();
36
37   lock()
38       Locks the element so that another process acting on the queue cannot
39       get a hold of it
40
41               if ( $element->lock() )
42               {
43                       print "Element successfully locked.\n";
44               }
45               else
46               {
47                       print "The element has already been removed or locked.\n";
48               }
49
50   requeue()
51       In case the processing of an element has failed
52
53               if ( $element->requeue() )
54               {
55                       print "Element successfully requeued.\n";
56               }
57               else
58               {
59                       print "The element has already been removed or been requeued.\n";
60               }
61
62   success()
63       Removes the element from the queue after its processing has
64       successfully been completed.
65
66               if ( $element->success() )
67               {
68                       print "Element successfully removed from queue.\n";
69               }
70               else
71               {
72                       print "The element has already been removed.\n";
73               }
74
75   data()
76       Returns the data initially queued.
77
78               my $data = $element->data();
79
80   requeue_count()
81       Returns the number of times that the current element has been requeued.
82
83               my $requeue_count = $element->requeue_count();
84
85   id()
86       Returns the ID of the current element
87
88               my $id = $element->id();
89
90   get_created_time()
91       Returns the unixtime at which the element was originally created.
92
93               my $created = $element->get_created_time();
94
95   is_over_lifetime()
96       Returns a boolean indicating whether the current element is over the
97       lifetime specified when instanciating the queue. This is especially
98       helpful if you retrieve a large batch of elements and do long
99       processing operations on each of them.
100
101               my $is_over_lifetime = $element->is_over_lifetime();
102

INTERNAL METHODS

104   get_queue()
105       Returns the Queue::DBI object used to pull the current element.
106
107               my $queue = $element->get_queue();
108

BUGS

110       Please report any bugs or feature requests through the web interface at
111       <https://github.com/guillaumeaubert/Queue-DBI/issues/new>.  I will be
112       notified, and then you'll automatically be notified of progress on your
113       bug as I make changes.
114

SUPPORT

116       You can find documentation for this module with the perldoc command.
117
118               perldoc Queue::DBI::Element
119
120       You can also look for information at:
121
122       •   GitHub's request tracker
123
124           <https://github.com/guillaumeaubert/Queue-DBI/issues>
125
126       •   AnnoCPAN: Annotated CPAN documentation
127
128           <http://annocpan.org/dist/Queue-DBI>
129
130       •   CPAN Ratings
131
132           <http://cpanratings.perl.org/d/Queue-DBI>
133
134       •   MetaCPAN
135
136           <https://metacpan.org/release/Queue-DBI>
137

AUTHOR

139       Guillaume Aubert <https://metacpan.org/author/AUBERTG>, "<aubertg at
140       cpan.org>".
141

ACKNOWLEDGEMENTS

143       I originally developed this project for ThinkGeek
144       (<http://www.thinkgeek.com/>). Thanks for allowing me to open-source
145       it!
146
148       Copyright 2009-2017 Guillaume Aubert.
149
150       This code is free software; you can redistribute it and/or modify it
151       under the same terms as Perl 5 itself.
152
153       This program is distributed in the hope that it will be useful, but
154       WITHOUT ANY WARRANTY; without even the implied warranty of
155       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE
156       file for more details.
157
158
159
160perl v5.36.0                      2022-07-22            Queue::DBI::Element(3)
Impressum