NAME
AnyMQ::Queue - AnyMQ Message Queue
SYNOPSIS
my $channel = AnyMQ->topic('Foo');
my $client = AnyMQ->new_listener($channel);
$client->poll_once(sub {
my @messages = @_;
# ...
});
$client->poll(sub {
my @messages = @_;
# ...
});
DESCRIPTION
An AnyMQ::Queue instance is a queue, each message put into the queue can be consumed exactly once. It's used as the client (or the subscriber in terms of pub/sub) in AnyMQ. An AnyMQ::Queue can subscribe to multiple AnyMQ::Topic.
METHODS
subscribe($topic)
Subscribe to a AnyMQ::Topic object.
poll($code_ref)
This is the event-driven poll mechanism, which accepts a callback. Messages are streamed to $code_ref
passed in.
poll_once($code_ref)
This method returns all messages since the last poll to $code_ref
.
append(@messages)
Append messages directly to the queue. You probably want to use publish
method of AnyMQ::Topic