Skip to content

Commit

Permalink
IDubboContext
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzeyi committed Feb 8, 2023
1 parent af4723d commit 873f4b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions eocontext/dubbo-context/context.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package dubbo_context
6 changes: 6 additions & 0 deletions eocontext/http-context/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ func WebsocketAssert(ctx eocontext.EoContext) (IWebsocketContext, error) {
err := ctx.Assert(&websocketContext)
return websocketContext, err
}

func DubboAssert(ctx eocontext.EoContext) (IDubboContext, error) {
var dubboContext IDubboContext
err := ctx.Assert(&dubboContext)
return dubboContext, err
}
14 changes: 14 additions & 0 deletions eocontext/http-context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ type IWebsocketContext interface {
IsWebsocket() bool
}

type IDubboContext interface {
IHttpContext
// MethodName 方法名
MethodName() string
// Interface 服务接口名 cn.org.api.UserService
Interface() string
// Serialization 序列化方式 hessian2、fastjson、gson、jdk、kryo、protobuf、avro
Serialization() string
// SetAttachment 类似http headers中的键值对,用于处理RPC请求和响应过程中需要但又不属于具体业务的信息
SetAttachment(key string, value interface{})
Attachments() map[string]interface{}
Attachment(string) (interface{}, bool)
}

type IHttpContext interface {
eocontext.EoContext
Request() IRequestReader // 读取原始请求
Expand Down

0 comments on commit 873f4b7

Please sign in to comment.