dubbo-go integration tool
- Install
go get -u github.com/dubbogo/dubbogo-cli
./dubbogo-cli-v2 show --r zookeeper --h 127.0.0.1:2181
The output is as follows
interface: org.apache.dubbo.game.basketballService
methods: []
interface: com.apache.dubbo.sample.basic.IGreeter
methods: []
interface: com.dubbogo.pixiu.UserService
methods: [CreateUser,GetUserByCode,GetUserByName,GetUserByNameAndAge,GetUserTimeout,UpdateUser,UpdateUserByName]
interface: org.apache.dubbo.gate.basketballService
methods: []
interface: org.apache.dubbo.game.basketballService
methods: []
interface: com.apache.dubbo.sample.basic.IGreeter
methods: []
interface: com.dubbogo.pixiu.UserService
methods: [CreateUser,GetUserByCode,GetUserByName,GetUserByNameAndAge,GetUserTimeout,UpdateUser,UpdateUserByName]
interface: org.apache.dubbo.gate.basketballService
methods: []
./dubbogo-cli-v2 new --path=./demo
This command will generate a dubbo-go example, you can refer to the example HOWTO to run.
package main
//go:generate go run "github.com/dubbogo/dubbogo-cli" hessian --include pkg
func main() {
}
package pkg
type Demo0 struct {
A string `json:"a"`
B string `json:"b"`
}
func (*Demo0) JavaClassName() string {
return "org.apache.dubbo.Demo0"
}
type Demo1 struct {
C string `json:"c"`
}
func (*Demo1) JavaClassName() string {
return "org.apache.dubbo.Demo1"
}
go generate
2022/01/28 11:58:11 === Generate start [pkg\demo.go] ===
2022/01/28 11:58:11 === Registry POJO [pkg\demo.go].Demo0 ===
2022/01/28 11:58:11 === Registry POJO [pkg\demo.go].Demo1 ===
2022/01/28 11:58:11 === Generate completed [pkg\demo.go] ===
pkg/demo.go
package pkg
import (
"github.com/apache/dubbo-go-hessian2"
)
type Demo0 struct {
A string `json:"a"`
B string `json:"b"`
}
func (*Demo0) JavaClassName() string {
return "org.apache.dubbo.Demo0"
}
type Demo1 struct {
C string `json:"c"`
}
func (*Demo1) JavaClassName() string {
return "org.apache.dubbo.Demo1"
}
func init() {
hessian.RegisterPOJO(&Demo0{})
hessian.RegisterPOJO(&Demo1{})
}
flag | description | default |
---|---|---|
include | Preprocess files parent directory path. | ./ |
thread | Worker thread limit. | (cpu core) * 2 |
error | Only print error message. | false |
####How to import other dependencies with one click | ||
Enter install all on the command line to directly introduce other dependencies of the tool | ||
Enter install triple to introduce the triple protocol dependency | ||
Enter install formatter to introduce formatter protocol dependency | ||
Enter install dubbo3grpc to introduce the dependency of dubbo3grpc protocol |