tree: 46da5aa0bb206785a46df6079e84604e8822fcb8 [path history] [tgz]
  1. go-client/
  2. go-server/
  3. README.md
golang/async/README.md

Use Async Feature

Implement this interface

//AsyncCallbackService callback interface for async
type AsyncCallbackService interface {
	CallBack(response CallbackResponse) // callback
}

like this

type UserProvider struct {
	GetUser func(ctx context.Context, req []interface{}, rsp *User) error
}

func (u *UserProvider) CallBack(res common.CallbackResponse) {
	fmt.Println("CallBack res:",res)
}

Dubbogo will run Async logic once network request finished.