v0.7.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 4 Imported by: 0




View Source
const (
	Consumer = iota

constant values for consumer and provider


This section is empty.


This section is empty.


type Invocation

type Invocation struct {
	Endpoint           string //service's ip and port, it is decided in load balancing
	Protocol           string
	SourceServiceID    string
	SourceMicroService string
	MicroServiceName   string //Target micro service name
	SchemaID           string //correspond struct name
	OperationID        string //correspond struct func name
	Args               interface{}
	URLPathFormat      string
	Reply              interface{}
	Ctx                context.Context        //ctx can save protocol headers
	Metadata           map[string]interface{} //local scope data
	RouteTags          utiltags.Tags          //route tags is decided in router handler
	Strategy           string                 //load balancing strategy
	Filters            []string

Invocation is the basic struct that used in go sdk to make client and transport layer transparent . developer should implements a client which is able to transfer invocation to there own request a protocol server should transfer request to invocation and then back to request

func New added in v0.7.1

func New(ctx context.Context) *Invocation

New create invocation, context can not be nil if you don't set ContextHeaderKey, then New will init it

func (*Invocation) GetSessionID added in v0.7.1

func (inv *Invocation) GetSessionID() string

GetSessionID return session id

func (*Invocation) Headers added in v0.7.1

func (inv *Invocation) Headers() map[string]string

Headers return a map that protocol plugin should deliver in transport

func (*Invocation) Reset added in v0.7.1

func (inv *Invocation) Reset()

Reset reset clear a invocation

func (*Invocation) SetHeader added in v0.7.1

func (inv *Invocation) SetHeader(k, v string)

SetHeader set headers, the client and server plugins should use them in protocol headers it is convenience but has lower performance than you use Headers[k]=v, when you have a batch of kv to set

func (*Invocation) SetMetadata added in v0.7.1

func (inv *Invocation) SetMetadata(key string, value interface{})

SetMetadata local scope params

func (*Invocation) SetSessionID added in v0.7.1

func (inv *Invocation) SetSessionID(value string)

SetSessionID set session id to invocation

type Response added in v0.7.1

type Response struct {
	Status int
	Result interface{}
	Err    error

Response is invocation response struct

type ResponseCallBack

type ResponseCallBack func(*Response) error

ResponseCallBack process invocation response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL