Skip to main content

grpc Binding

BindingServerClient

grpc Binding

Zilla runtime grpc binding.

grpc_server:
  type: grpc
  kind: server
  options:
    services:
      - proto/echo.proto
  routes:
    - when:
        - method: example.EchoService/*
          metadata:
            custom-text: custom value
            custom-binary:
              base64: Y3VzdG9tIHZhbHVl
      exit: echo_server

 












Summary

Defines a binding with grpc protocol support, with server or client behavior.

The server kind grpc binding adapts http request-response streams to grpc request-response streams, with support for both application/grpc+proto and application/grpc-web+proto content types.

The client kind grpc binding adapts grpc request-response streams to http request-response streams.

Configuration

kind*

enum [ "client", "server" ]

Behave as a grpc client or server.

kind: server

options

object

grpc-specific options.

options:
  services:
    - proto/echo.proto

options.services

array of string

Protobuf service definition filenames, typically with .proto filename extension.

exit

string

Default exit binding when no conditional routes are viable.

exit: echo_server

routes

array of object

Conditional grpc-specific routes.

routes:
  - guarded:
      my_guard:
        - echo:messages
    when:
      - method: example.EchoService/*
        metadata:
          custom-text: custom value
          custom-binary:
            base64: Y3VzdG9tIHZhbHVl
    exit: echo_server

routes[].guarded

object as named map of string:string array

Roles required by named guard.

routes:
  - guarded:
      my_guard:
        - echo:messages

routes[].when

array of object

List of conditions (any match) to match this route.
Read more: When a route matches

routes:
    when:
      - method: example.EchoService/*
        metadata:
          custom-text: custom value
          custom-binary:
            base64: Y3VzdG9tIHZhbHVl

when[].method

string

gRPC service method name, such as example.EchoService/EchoUnary, or service method pattern such as example.EchoService/*.

when[].metadata

map of name: value properties

Metadata header name value pairs (all match).

Each metadata header value can be string or object with base64 property.

metadata.base64

string

Base64 encoded value for binary metadata header.

routes[].exit*

string

Routed exit binding when conditional route matches.

routes:
  - when:
    ...
    exit: echo_server

* required