NAME
IPC::Manager::Service::Peer - Peer connection class for IPC::Manager services
DESCRIPTION
This class represents a connection to another service in the IPC system. It provides methods to send requests and get responses through the parent service's client connection.
SYNOPSIS
my $peer = IPC::Manager::Service::Peer->new(
name => 'other-service',
service => $service_obj,
);
# Check if peer is ready
if ($peer->ready) {
# Send a request
my $id = $peer->send_request({action => 'do_something'});
# Get a response (non-blocking)
if (my $response = $peer->get_response($id)) {
...
}
}
ATTRIBUTES
- name
-
The name of the peer service (required).
- service
-
The parent service object (required). Must be running in the current process.
METHODS
- $bool = $self->ready()
-
Check if the peer is ready for requests.
- $id = $self->send_request($req)
- $self->send_request($req, $cb)
-
Sends a request to the peer.
$reqis the request data,$cbis an optional callback for async responses.Returns the request ID.
- $res = $self->get_response($id)
-
Gets a response for a previously sent request.
If the response is ready it is returned, otherwise undef is returned.
Exceptions will be thrown if the $id is invalid, or if the response has already been fetched.
SOURCE
The source code repository for IPC::Manager can be found at https://github.com/exodist/IPC-Manager.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.