GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ANYMQ::QUEUE (3)

.ds Aq ’

NAME

AnyMQ::Queue - AnyMQ Message Queue

CONTENTS

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.

    unpoll

Cancels a running poll, which will result in on_timeout being called.

poll_once($code_ref, CW$timeout)

This method returns all messages since the last poll to $code_ref. It blocks for $timeout seconds if there’s currently no messages available.

    destroyed(BOOL)

Marking the current queue as destroyed or not.

    timeout($seconds)

Timeout value for this queue. Default is 55.

on_error(sub { my ($queue, CW$error, CW@msg) = CW@_; ... })

Sets the error handler invoked when poll or poll_once callbacks fail. By default the queue is marked as destroyed. If you register this error handler, you should call $queue->destroyed(1) should you wish to mark the queue as destroyed and reclaim resources.

Note that for queues that are currently poll’ed, you may unset the persistent attribute to avoid the queue from being destroyed, and can be used for further poll or poll_once calls. In this case, on_timeout will be triggered if poll or poll_once is not called after $self->timeout seconds.

on_timeout(sub { my ($queue, CW$error) = CW@_; ... })

If a queue is not currently polled, this callback will be triggered after $self->timeout seconds. The default behaviour is marking the queue as destroyed.

    append(@messages)

Append messages directly to the queue. You probably want to use publish method of AnyMQ::Topic

SEE ALSO

AnyMQ AnyMQ::Topic
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ANYMQ::QUEUE (3) 2013-02-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.