KubeMQ.EventStreamHandle (kubemq v1.0.1)

Copy Markdown View Source

Handle for streaming events via a bidirectional gRPC stream.

Obtained via KubeMQ.Client.send_event_stream/1. The GenServer serializes writes to the underlying stream (mutex equivalent via message queue).

Usage

{:ok, handle} = KubeMQ.Client.send_event_stream(client)
:ok = KubeMQ.EventStreamHandle.send(handle, event)
:ok = KubeMQ.EventStreamHandle.close(handle)

Summary

Functions

Returns a specification to start this module under a supervisor.

Close the event stream handle, terminating the underlying gRPC stream.

Send an event through the streaming handle.

Types

t()

@type t() :: GenServer.server()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(handle)

@spec close(t()) :: :ok

Close the event stream handle, terminating the underlying gRPC stream.

send(handle, event)

@spec send(t(), KubeMQ.Event.t()) :: :ok | {:error, KubeMQ.Error.t()}

Send an event through the streaming handle.

The event is written to the underlying bidirectional gRPC stream. Returns :ok on success or {:error, %KubeMQ.Error{}} on failure.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()