Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos multi service source discovery #6213

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lixinhan
Copy link
Contributor

增加了 对 services.consumers.*.registry.address 单独配置地址的支持

如单独配置address地址,默认复制:services.drivers.nacos 下的配置 然后覆盖掉会使用 address 覆盖掉 uri 参数。

增加了 某个服务单独配置服务源的支持 services.consumers.*.registry.config

config 同 services.drivers.nacos 参数
config 参数 优先级大于 address 参数

'consumers' => [
        [
            // name 需与服务提供者的 name 属性相同
            'name' => 'xxxx.grpc.xxxx.xxxx',
            'service' => \App\Grpc\OrderServiceInterface::class,
//            // 对应容器对象 ID,可选,默认值等于 service 配置的值,用来定义依赖注入的 key
//            'id' => \App\Grpc\OrderServiceInterface::class,
            'protocol' => 'grpc',
            'registry' => [
                'protocol' => 'nacos',
//                'address' => 'http://'.env("NACOS_HOST").':'.env("NACOS_PORT"),
//                'address' => 'http://'.env("NACOS_HOST").':'.env("NACOS_PORT"),
                'config'=>[
                    'host' => env("NACOS_HOST"),
                    'port' => env("NACOS_PORT"),
                    'username' => env("NACOS_USERNAME"),
                    'password' => env("NACOS_PASSWORD"),
                    'guzzle' => [
                        'config' => null,
                    ],
                    'group_name' => 'tms-order',
                    'namespace_id' => 'tms-order',
                    'heartbeat' => 5,
                    'ephemeral' => true,
                ],
            ],
        ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant