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

support $invokeAsync #1674

Merged
merged 2 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions common/constant/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ const (
)

const (
DefaultKey = "default"
Generic = "$invoke"
Echo = "$echo"
DefaultKey = "default"
Generic = "$invoke"
GenericAsync = "$invokeAsync"
Echo = "$echo"
)

// default filters
Expand Down
9 changes: 6 additions & 3 deletions filter/generic/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (
// isCallingToGenericService check if it calls to a generic service
func isCallingToGenericService(invoker protocol.Invoker, invocation protocol.Invocation) bool {
luky116 marked this conversation as resolved.
Show resolved Hide resolved
return isGeneric(invoker.GetURL().GetParam(constant.GenericKey, "")) &&
invocation.MethodName() != constant.Generic
(invocation.MethodName() == constant.Generic ||
invocation.MethodName() == constant.GenericAsync)
}

// isMakingAGenericCall check if it is making a generic call to a generic service
func isMakingAGenericCall(invoker protocol.Invoker, invocation protocol.Invocation) bool {
return isGeneric(invoker.GetURL().GetParam(constant.GenericKey, "")) &&
invocation.MethodName() == constant.Generic &&
(invocation.MethodName() == constant.Generic ||
invocation.MethodName() == constant.GenericAsync) &&
invocation.Arguments() != nil &&
len(invocation.Arguments()) == 3
}
Expand All @@ -50,7 +52,8 @@ func isGeneric(generic string) bool {

// isGenericInvocation determines if the invocation has generic format
func isGenericInvocation(invocation protocol.Invocation) bool {
return invocation.MethodName() == constant.Generic &&
return (invocation.MethodName() == constant.Generic ||
invocation.MethodName() == constant.GenericAsync) &&
invocation.Arguments() != nil &&
len(invocation.Arguments()) == 3
}
Expand Down