NAME

Zing::PubSub - Pub/Sub Store

ABSTRACT

Generic Pub/Sub Store

SYNOPSIS

use Zing::PubSub;

my $pubsub = Zing::PubSub->new(name => 'tasks');

# $pubsub->recv;

DESCRIPTION

This package provides a general-purpose publish/subscribe store abstraction.

INHERITS

This package inherits behaviors from:

Zing::Repo

LIBRARIES

This package uses type constraints from:

Zing::Types

METHODS

This package implements the following methods:

poll

poll() : Poll

The poll method returns a Zing::Poll object which can be used to perform a blocking-fetch from the store.

poll example #1
# given: synopsis

$pubsub->poll;

recv

recv() : Maybe[HashRef]

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

recv example #1
# given: synopsis

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

$pubsub->send({ task => 'restart' });

$pubsub->recv;

send

send(Str $key, HashRef $value) : Int

The send method sends a new message to the store and return the message count.

send example #1
# given: synopsis

$pubsub->send({ task => 'restart' });
send example #2
# given: synopsis

$pubsub->drop;

$pubsub->send({ task => 'stop' });

$pubsub->send({ task => 'restart' });

term

term(Str @keys) : Str

The term method return a term (safe string) for the store.

term example #1
# given: synopsis

$pubsub->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