The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Zing::Zang::Worker - Worker Process

ABSTRACT

Worker Process Implementation

SYNOPSIS

  use Zing::Zang::Worker;

  my $zang = Zing::Zang::Worker->new(
    on_handle => sub {
      my ($self, $name, $data) = @_;

      $self->{handled} = [$name, $data];
    },
    queues => ['tasks']
  );

  # $zang->execute;

DESCRIPTION

This package provides a Zing::Worker which uses callbacks and doesn't need to be subclassd. It supports providing a process perform method as on_perform and a receive method as on_receive which operate as expected, and also a handle method as on_handle which is executed whenever a message is received from one of the queue(s).

INHERITS

This package inherits behaviors from:

Zing::Worker

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

on_handle

  on_handle(Maybe[CodeRef])

This attribute is read-only, accepts (Maybe[CodeRef]) values, and is optional.

on_perform

  on_perform(Maybe[CodeRef])

This attribute is read-only, accepts (Maybe[CodeRef]) values, and is optional.

on_receive

  on_receive(Maybe[CodeRef])

This attribute is read-only, accepts (Maybe[CodeRef]) values, and is optional.

queues

  queues(ArrayRef[Str])

This attribute is read-only, accepts (ArrayRef[Str]) values, and is required.

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