NAME
Google::gRPC::Channel - Multiplexed HTTP/2 gRPC channel managing streams and keepalive
SYNOPSIS
use Google::gRPC::Channel;
my $channel = Google::gRPC::Channel->new(
target => 'spanner.googleapis.com:443',
auth_token => $access_token,
engine_type => 'nghttp2', # or 'pp'
timeout => 30,
keepalive_time_sec => 60,
keepalive_timeout_sec => 20,
);
my $stream = $channel->create_stream(
service => 'google.spanner.v1.Spanner',
method => 'CreateSession',
request => $request_msg,
response_class => 'Google::Cloud::Spanner::V1::Session',
type => 'unary',
);
DESCRIPTION
Google::gRPC::Channel represents a single HTTP/2 gRPC channel to a remote target. It wraps an underlying HTTP/2 engine (Google::gRPC::Engine::NGHTTP2 or Google::gRPC::Engine::PP), multiplexes concurrent Google::gRPC::Stream instances, injects gRPC pseudo-headers, Bearer authorization, and grpc-timeout deadlines, and tracks channel activity for keepalive.
ATTRIBUTES
target (required) - Remote
host:portauthority.auth_token - Optional OAuth 2.0 Bearer token.
engine_type - Optional engine override (
'nghttp2'or'pp').timeout - Optional default per-stream deadline.
keepalive_time_sec / keepalive_timeout_sec - Optional HTTP/2 keepalive intervals.
engine - Underlying Google::gRPC::Engine instance.
streams - HashRef of active stream IDs to Google::gRPC::Stream objects.
last_activity_time - High-resolution timestamp of the last stream event.
METHODS
create_stream
my $stream = $channel->create_stream(
service => $service_name,
method => $method_name,
request => $request_msg_or_bytes,
response_class => $response_class,
type => 'unary', # 'unary', 'server_stream', 'client_stream', 'bidi'
timeout => 15, # optional override
);
Submits a new HTTP/2 stream on the channel and returns a Google::gRPC::Stream handle.
SEE ALSO
Google::gRPC, Google::gRPC::Client, Google::gRPC::ChannelPool, Google::gRPC::Stream, Google::gRPC::Engine
AUTHOR
C.J. Collier <cjac@google.com>
LICENSE
Apache License 2.0