The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

Zing::Queue - Message Queue

ABSTRACT

Generic Message Queue

SYNOPSIS

  use Zing::Queue;

  my $queue = Zing::Queue->new(name => 'tasks');

  # $queue->recv;

DESCRIPTION

This package provides a general-purpose message queue abstraction.

INHERITS

This package inherits behaviors from:

Zing::PubSub

LIBRARIES

This package uses type constraints from:

Zing::Types

METHODS

This package implements the following methods:

recv

  recv() : Maybe[HashRef]

The recv method receives a single new message from the channel.

recv example #1
  # given: synopsis

  $queue->recv;
recv example #2
  # given: synopsis

  $queue->send({ restart => { after => 'cleanup' }});

  $queue->recv;

send

  send(HashRef $value) : Int

The send method sends a new message to the queue and returns the message count.

send example #1
  # given: synopsis

  $queue->send({ restart => { after => 'cleanup' }});
send example #2
  # given: synopsis

  $queue->drop;

  $queue->send({ restart => { after => 'cleanup' }});

size

  size() : Int

The size method returns the number of messages in the queue.

size example #1
  # given: synopsis

  my $size = $queue->size;

term

  term() : Str

The term method generates a term (safe string) for the queue.

term example #1
  # given: synopsis

  $queue->term;

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues