### Install Dependencies Source: https://github.com/therealreal/conn_grpc/blob/main/misc/demo/README.md Run this command to fetch project dependencies. ```elixir mix deps.get ``` -------------------------------- ### Get Standalone Channel Source: https://github.com/therealreal/conn_grpc/blob/main/misc/demo/README.md Obtain a standalone gRPC channel using MyChannel.get(). ```elixir MyChannel.get() ``` -------------------------------- ### Run ConnGRPC App Source: https://github.com/therealreal/conn_grpc/blob/main/misc/demo/README.md Start the ConnGRPC application in an interactive Elixir shell. ```elixir iex -S mix run ``` -------------------------------- ### Get a Single Channel Connection Source: https://github.com/therealreal/conn_grpc/blob/main/guides/overview.md Retrieve a single persistent channel connection using `get/0` from a module defined with `ConnGRPC.Channel`. ```elixir {:ok, channel} = DemoChannel.get() ``` -------------------------------- ### Get a Channel from the Pool Source: https://github.com/therealreal/conn_grpc/blob/main/guides/overview.md Retrieve a channel connection from a `ConnGRPC.Pool` using `get_channel/0`. Channels are distributed using round-robin. ```elixir {:ok, channel} = DemoPool.get_channel() ``` -------------------------------- ### Get Channel from Pool Source: https://github.com/therealreal/conn_grpc/blob/main/misc/demo/README.md Retrieve a gRPC channel from the connection pool via MyPool.get_channel(). ```elixir MyPool.get_channel() ``` -------------------------------- ### View Supervision Tree Source: https://github.com/therealreal/conn_grpc/blob/main/misc/demo/README.md Launch the :observer tool to inspect the application's supervision tree. ```elixir :observer.start() ``` -------------------------------- ### Define a Single Channel Module Source: https://github.com/therealreal/conn_grpc/blob/main/guides/overview.md Define a module using `ConnGRPC.Channel` for a single persistent gRPC channel. Specify the address and options for the connection. ```elixir defmodule DemoChannel do use ConnGRPC.Channel, address: "localhost:50051", opts: [] end ``` -------------------------------- ### Define a Channel Pool Module Source: https://github.com/therealreal/conn_grpc/blob/main/guides/overview.md Define a module using `ConnGRPC.Pool` to manage a pool of persistent gRPC channels. Configure pool size and channel connection details. ```elixir defmodule DemoPool do use ConnGRPC.Pool, pool_size: 5, channel: [address: "localhost:50051", opts: []] end ``` -------------------------------- ### Add ConnGRPC to Dependencies Source: https://github.com/therealreal/conn_grpc/blob/main/guides/overview.md Add ConnGRPC and gRPC Elixir to your project's dependencies in `mix.exs`. ```elixir def deps do [ {:conn_grpc, "~> 0.1"}, # You also need to have gRPC Elixir installed {:grpc, "~> 0.5"} ] end ``` -------------------------------- ### Attach Telemetry Handler Source: https://github.com/therealreal/conn_grpc/blob/main/guides/telemetry.md Use :telemetry.attach/4 or :telemetry.attach_many/4 to register a handler function for ConnGRPC telemetry events. This is useful for monitoring connection status, durations, and pool performance. ```elixir iex> :telemetry.attach("conn_grpc_channel_events", [:conn_grpc, :channel, :get], &IO.inspect/1, :user) :ok iex> :telemetry.attach("conn_grpc_pool_events", [:conn_grpc, :pool, :get_channel], &IO.inspect/1, :user) :ok ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.