apache / apache/dubbo

dubbo泛化调用的场景下,后两个参数怎么传比较合理

Open
#10,091 1 comment 0 reactions 0 assignees View on GitHub
type/discussion
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

dubbo的泛化调用,主要是为了在consumer端不需要引入provider的api的情况下,还能正常调用,也就是某一个consumer通过泛化调用可以调用到任意的provider,我是使用在网关这种项目中,外层请求是http,然后通过一个网关,往里面请求都是dubbo调用。这里面interface的参数比较好传,http请求的时候会传进来,$invoke("sayHello", new String[] {"java.lang.String"}, new Object[] {"world"})方法有3个参数,第一个也可以传进来,后面两个参数怎么传?我现在的实现方式是consumer(也就是网关项目)把provider的api都引进来了,但是感觉和泛化调用的初衷就违背了。
有3个问题请教一下:
1. 大家泛化调用都是什么场景?我觉得场景很是局限。
2. 大家后两个参数怎么传的?
3. 我感觉后两个参数是不是可以定义成一个参数,就是一个json字符串,由provider端来解析,就像springmvc的controller接口的参数一样,自动解析成provider端api的参数类型。

Contributor guide

Open the contributing guide

Research direction

Start with Dubbo's generic invocation API, especially the $invoke method name, parameter-type array, and argument array described in the issue. Review how gateway consumers currently represent provider arguments and assess the proposed JSON-string approach. Done means a clearly scoped, maintainer-approved behavior or change, with its supported use cases documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.