func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
	r.lock.RLock()
	defer r.lock.RUnlock()
	value, ok := r.attributes[key]
	if ok {
		return value
	}
	return defaultValue
}
AttributeByKey gets attribute by @key. If it is not exist, it will return default value.
package invocation
import (
	"reflect"
	"strings"
	"sync"
)
import (
	"dubbo.apache.org/dubbo-go/v3/common"
	"dubbo.apache.org/dubbo-go/v3/common/constant"
	"dubbo.apache.org/dubbo-go/v3/protocol"
)
type RPCInvocation struct {
	methodName string
	parameterTypeNames []string
	parameterTypes     []reflect.Type
	parameterValues []reflect.Value
	arguments       []interface{}
	reply           interface{}
	callBack        interface{}
	attachments     map[string]interface{}
	attributes map[string]interface{}
	invoker    protocol.Invoker
	lock       sync.RWMutex
}
func NewRPCInvocation(methodName string, arguments []interface{}, attachments map[string]interface{}) *RPCInvocation {
	return &RPCInvocation{
		methodName:  methodName,
		arguments:   arguments,
		attachments: attachments,
		attributes:  make(map[string]interface{}, 8),
	}
}
func NewRPCInvocationWithOptions(opts ...option) *RPCInvocation {
	invo := &RPCInvocation{}
	for _, opt := range opts {
		opt(invo)
	}
	if invo.attributes == nil {
		invo.attributes = make(map[string]interface{})
	}
	return invo
}
func (r *RPCInvocation) MethodName() string {
	return r.methodName
}
func (r *RPCInvocation) ParameterTypes() []reflect.Type {
	return r.parameterTypes
}
func (r *RPCInvocation) ParameterTypeNames() []string {
	return r.parameterTypeNames
}
func (r *RPCInvocation) ParameterValues() []reflect.Value {
	return r.parameterValues
}
func (r *RPCInvocation) Arguments() []interface{} {
	return r.arguments
}
func (r *RPCInvocation) Reply() interface{} {
	return r.reply
}
func (r *RPCInvocation) SetReply(reply interface{}) {
	r.reply = reply
}
func (r *RPCInvocation) Attachments() map[string]interface{} {
	return r.attachments
}
func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string {
	r.lock.RLock()
	defer r.lock.RUnlock()
	if r.attachments == nil {
		return defaultValue
	}
	value, ok := r.attachments[key]
	if ok {
		return value.(string)
	}
	return defaultValue
}
func (r *RPCInvocation) Attachment(key string) interface{} {
	r.lock.RLock()
	defer r.lock.RUnlock()
	if r.attachments == nil {
		return nil
	}
	value, ok := r.attachments[key]
	if ok {
		return value
	}
	return nil
}
func (r *RPCInvocation) Attributes() map[string]interface{} {
	return r.attributes
}