GRPC.Endpoint (gRPC v0.11.5)

View Source

GRPC endpoint for multiple servers and interceptors.

Usage

defmodule Your.Endpoint do
  use GRPC.Endpoint

  intercept GRPC.Server.Interceptors.Logger, level: :info
  intercept Other.Interceptor
  run HelloServer, interceptors: [HelloHaltInterceptor]
  run FeatureServer
end

Interceptors will be run around your rpc calls from top to bottom. And you can even set interceptors for some of servers. In the above example, [GRPC.Server.Interceptors.Logger, Other.Interceptor, HelloHaltInterceptor] will be run for HelloServer, and [GRPC.Server.Interceptors.Logger, Other.Interceptor] will be run for FeatureServer.

Summary

Functions

intercept(name)

(macro)

intercept(name, opts)

(macro)

Options

opts keyword will be passed to Interceptor's init/1

run(servers, opts \\ [])

(macro)

Options

  • :interceptors - custom interceptors for these servers