Beekeeper

 view release on metacpan or  search on metacpan

lib/Beekeeper/Client.pm  view on Meta::CPAN

        $send_args{'buffer_id'} = $args{'buffer_id'};
    }

    $self->{_BUS}->publish( payload => \$json, %send_args );
}


sub accept_notifications {
    my ($self, %args) = @_;

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    my $callbacks = $self->{_CLIENT}->{callbacks};

    foreach my $fq_meth (keys %args) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or croak "Invalid notification method '$fq_meth'";

        my ($service, $method) = ($1, $2);

lib/Beekeeper/Client.pm  view on Meta::CPAN

                die "Could not subscribe to topic '$topic' $at" unless $success;
            }
        );
    }
}


sub stop_accepting_notifications {
    my ($self, @methods) = @_;

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    croak "No method specified" unless @methods;

    foreach my $fq_meth (@methods) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or croak "Invalid method '$fq_meth'";

        my ($service, $method) = ($1, $2);

lib/Beekeeper/Service/LogTail.pm  view on Meta::CPAN

    return $resp->result;
}

sub tail_async {
    my ($class, %args) = @_;

    my $on_success = delete $args{'on_success'};
    my $on_error   = delete $args{'on_error'};

    unless ($on_error) {
        my ($file, $line) = (caller)[1,2];
        $on_error = sub { die $_[0]->message . " at $file line $line\n"; };
    }

    my $client = Beekeeper::Client->instance;
    my $guard = $client->__use_authorization_token('BKPR_ADMIN');
    my $timeout = delete $args{'timeout'};

    $client->call_remote_async(
        method     => '_bkpr.logtail.tail',
        params     => \%args,

lib/Beekeeper/Service/Supervisor.pm  view on Meta::CPAN

    return $resp->result;
}

sub get_workers_status_async {
    my ($class, %args) = @_;

    my $on_success = delete $args{'on_success'};
    my $on_error   = delete $args{'on_error'};

    unless ($on_error) {
        my ($file, $line) = (caller)[1,2];
        $on_error = sub { die $_[0]->message . " at $file line $line\n"; };
    }

    my $client = Beekeeper::Client->instance;
    my $guard = $client->__use_authorization_token('BKPR_ADMIN');
    my $timeout = delete $args{'timeout'};

    $client->call_remote_async(
        method     => '_bkpr.supervisor.get_workers_status',
        params     => \%args,

lib/Beekeeper/Service/Supervisor.pm  view on Meta::CPAN

    return $resp->result;
}

sub get_services_status_async {
    my ($class, %args) = @_;

    my $on_success = delete $args{'on_success'};
    my $on_error   = delete $args{'on_error'};

    unless ($on_error) {
        my ($file, $line) = (caller)[1,2];
        $on_error = sub { die $_[0]->message . " at $file line $line\n"; };
    }

    my $client = Beekeeper::Client->instance;
    my $guard = $client->__use_authorization_token('BKPR_ADMIN');
    my $timeout = delete $args{'timeout'};

    $client->call_remote_async(
        method     => '_bkpr.supervisor.get_services_status',
        params     => \%args,

lib/Beekeeper/Worker.pm  view on Meta::CPAN

    return undef; # do not authorize
}


sub accept_notifications {
    my ($self, %args) = @_;

    my $worker    = $self->{_WORKER};
    my $callbacks = $worker->{callbacks};

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    foreach my $fq_meth (keys %args) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or die "Invalid notification method '$fq_meth' $at";

        my ($service, $method) = ($1, $2);

        my $callback = $self->__get_cb_coderef($fq_meth, $args{$fq_meth});

lib/Beekeeper/Worker.pm  view on Meta::CPAN

}


sub accept_remote_calls {
    my ($self, %args) = @_;

    my $worker = $self->{_WORKER};
    my $callbacks = $worker->{callbacks};
    my %subscribed_to;

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    foreach my $fq_meth (keys %args) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or die "Invalid remote call method '$fq_meth' $at";

        my ($service, $method) = ($1, $2);

        my $callback = $self->__get_cb_coderef($fq_meth, $args{$fq_meth});

lib/Beekeeper/Worker.pm  view on Meta::CPAN

    if (defined $timing_tasks) {
        $BUSY_TIME += Time::HiRes::time - $BUSY_SINCE;
        undef $BUSY_SINCE;
    }
}


sub stop_accepting_notifications {
    my ($self, @methods) = @_;

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    die "No method specified $at" unless @methods;

    foreach my $fq_meth (@methods) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or die "Invalid method '$fq_meth' $at";

        my ($service, $method) = ($1, $2);

lib/Beekeeper/Worker.pm  view on Meta::CPAN

                AnyEvent::postpone { $self->__drain_task_queue };
            }
        );
    }
}


sub stop_accepting_calls {
    my ($self, @methods) = @_;

    my ($file, $line) = (caller)[1,2];
    my $at = "at $file line $line\n";

    die "No method specified $at" unless @methods;

    foreach my $fq_meth (@methods) {

        $fq_meth =~ m/^  ( [\w-]+ (?: \.[\w-]+ )* ) 
                      \. ( [\w-]+ | \* ) $/x or die "Invalid remote call method '$fq_meth' $at";

        my ($service, $method) = ($1, $2);



( run in 0.775 second using v1.01-cache-2.11-cpan-a3c8064c92c )