Coder Social home page Coder Social logo

hyperf-grpc-client's Introduction

hyperf-grpc-client

hyperf grpc 客户端,支持服务发现、负载均衡、Dtm通过服务发现、服务链路跟踪等

请先阅读hyperf文档 grpc服务一节 https://hyperf.wiki/3.0/#/zh-cn/grpc

引用

composer require crayoon/hyperf-grpc-client

生成配置文件

// 若有引用 crayoon/hyperf-grpc 请使用crayoon/hyperf-grpc发布配置
// php bin/hyperf.php vendor:publish crayoon/hyperf-grpc
// 否则
php bin/hyperf.php vendor:publish crayoon/hyperf-grpc-client

使用

// 客户端 继承 \Crayoon\HyperfGrpcClient\BaseGrpcClient 即可
class GoodsClient extends \Crayoon\HyperfGrpcClient\BaseGrpcClient {
    ...
}

DTM

兼容dtm通过服务发现负载调用服务

请先阅读hyperf文档 DTM一节 https://hyperf.wiki/3.0/#/zh-cn/distributed-transaction

// 引入
composer require dtm/dtm-client
// 发布配置
php bin/hyperf.php vendor:publish dtm/dtm-client

修改 config/dependencies.php

return [
    // 加入下面两个映射
    \DtmClient\Api\GrpcApi::class => \Crayoon\HyperfGrpcClient\DTM\GrpcApi::class,
    \Crayoon\HyperfGrpcClient\GrpcClientManager::class => \Crayoon\HyperfGrpcClient\DTM\GrpcClientManagerWithDtmClient::class,
];

hyperf-grpc-client's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.