UR::Service::RPC::Message(3pm)

UR::Service::RPC::Message3pm

Serializable object appropriate for sending rpc messages

Usage

  my $msg = UR::Service::RPC::Message->create(
                           target_class => 'URT::RPC::Thingy',
                           method_name  => 'join',
                           params       => ['-', @join_args],
                           'wantarray'  => 0,
                         );
  $msg->send($fh);
  my $resp = UR::Service::RPC::Message->recv($fh, 5);

Overview

This class is used as a message-passing interface by the RPC service modules.

Properties

These properties should be filled in by the initiating caller

method_name => Text

The name of the subroutine the initiator whishes to call.

target_class => Text

The namespace the initiator wants the subroutine to be called in

params => ARRAY

List of parameters to pass to the subroutine

wantarray => Boolean

What wantarray() context the subroutine should be called in.

These properties are assigned after the RPC call to the subroutine

return_values => ARRAY

List of values returned by the subroutine

exception

On the receiving side, the subroutine is called within an eval. If there was an exception, "exception" stores the value of $@, or the empty string. The receiving side should also fill-in "exception" if there was an authentication failure.

fh

"recv" fills this in with the file handle the message was read from.

Methods

send
  $bytes = $msg->send($fh);

Serializes the Message object with FreezeThaw and writes the data to the filehandle $fh. Returns the number of bytes written. $bytes will be false if there was an error.

recv
  $response = UR::Service::RPC::Message->recv($fh,$timeout);
  $response = $msg->recv();

Reads a serialized Message from the filehandle and constructs a Message object that is then returned to the caller. In the first case, it reads from the given filehandle, waiting a maximum of $timeout seconds with select before giving up. In the second case, it reads from whatever filehandle is stored in $msg to read data from.

Releases

6 releases since Debian 8 (Jessie); the text changed 4 times.

  1. 8
  2. 9
  3. 10–11
  4. 12
  5. 13

From libur-perl 0.470+ds-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.