微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带有特使的 gRPC 网络 - 连接到多个服务时一元调用不起作用

如何解决带有特使的 gRPC 网络 - 连接到多个服务时一元调用不起作用

我正在尝试在 VueJS(在浏览器中)中创建 grpc-web 客户端,该客户端连接到服务器流并进行一元调用

我使用 generator plugin 生成了我的客户端。我正在使用 *webtext 版本,使用命令生成

protoc -I=src/proto *files* --js_out=import_style=commonjs:src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:src

生成器为每个服务生成一个客户端。

我毫无问题地连接它们,但是,当我订阅多个客户端上的流时,一元调用似乎被阻止(从应用程序发送,但没有任何内容到达服务器)。一个客户端上的多个流工作正常。 Java 客户端工作正常。

我怀疑 envoy 代理有问题,我基本上使用的是示例配置:

admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 0.0.0.0,port_value: 9901 }

static_resources:
  listeners:
    - name: listener_0
      address:
        socket_address: { address: 0.0.0.0,port_value: 8081 }
      filter_chains:
        - filters:
            - name: envoy.filters.network.http_connection_manager
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.httpconnectionManager
                codec_type: auto
                stat_prefix: ingress_http
                route_config:
                  name: local_route
                  virtual_hosts:
                    - name: local_service
                      domains: ["*"]
                      routes:
                        - match: { prefix: "/" }
                          route:
                            cluster: echo_service
                            timeout: 0s
                            max_stream_duration:
                              grpc_timeout_header_max: 0s
                      cors:
                        allow_origin_string_match:
                          - prefix: "*"
                        allow_methods: GET,PUT,DELETE,POST,OPTIONS
                        allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
                        max_age: "1728000"
                        expose_headers: custom-header-1,grpc-status,grpc-message
                http_filters:
                  - name: envoy.filters.http.grpc_web
                  - name: envoy.filters.http.cors
                  - name: envoy.filters.http.router
  clusters:
    - name: echo_service
      connect_timeout: 0.25s
      type: logical_dns
      http2_protocol_options: {}
      lb_policy: round_robin
      load_assignment:
        cluster_name: cluster_0
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 10.0.2.83
                      port_value: 50051

有什么想法吗?有没有人遇到过同样的问题?谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。