Amazon-SQS-ProducerConsumer
view release on metacpan or search on metacpan
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
bless $me, $class;
$me->initialize;
return $me;
}
sub initialize {
my $me = shift;
$me->{n_messages} ||= DEFAULT_N_MESSAGES;
$me->{wait_seconds} ||= DEFAULT_WAIT_SECONDS;
$me->SUPER::initialize;
}
=head2 next()
This will receive a message from this Publisher's queue. When the queue is empty it will wait a new message for wait_seconds seconds.
=cut
sub next {
my $me = shift;
lib/Amazon/SQS/Producer.pm view on Meta::CPAN
my $me = \%args;
bless $me, $class;
$me->initialize;
return $me;
}
sub initialize {
my $me = shift;
$me->{sleep_after_starting_consumer} = 2 if not exists $me->{sleep_after_starting_consumer};
$me->SUPER::initialize;
}
=head2 publish(%params)
This will publish a message to this Publisher's queue, and start a consumer if this is the first message this Publisher has published. The message body will be a JSON representaton of the method's argument hash. If the first argument is a reference t...
=cut
sub publish {
if ( ref $_[0] and ! $_[0]->{queue} ) { goto &fork_consumer }
( run in 0.489 second using v1.01-cache-2.11-cpan-a5abf4f5562 )