Versions in this module Expand all Collapse all v1 v1.18.3 Feb 20, 2020 v1.18.2 Feb 20, 2020 Changes in this version + var DefaultBackoff = exponentialBackoff + var DefaultClient Client = newRpcClient() + var DefaultCodecs = map[string]codec.NewCodec + var DefaultContentType = "application/protobuf" + var DefaultPoolSize = 100 + var DefaultPoolTTL = time.Minute + var DefaultRequestTimeout = time.Second * 5 + var DefaultRetries = 1 + var DefaultRetry = RetryOnError + func Call(ctx context.Context, request Request, response interface{}, opts ...CallOption) error + func NewContext(ctx context.Context, c Client) context.Context + func Publish(ctx context.Context, msg Message, opts ...PublishOption) error + func RetryAlways(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func RetryOnError(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func String() string + type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error) + type CallFunc func(ctx context.Context, node *registry.Node, req Request, rsp interface{}, ...) error + type CallOption func(*CallOptions) + func WithAddress(a ...string) CallOption + func WithBackoff(fn BackoffFunc) CallOption + func WithCallWrapper(cw ...CallWrapper) CallOption + func WithDialTimeout(d time.Duration) CallOption + func WithRequestTimeout(d time.Duration) CallOption + func WithRetries(i int) CallOption + func WithRetry(fn RetryFunc) CallOption + func WithSelectOption(so ...selector.SelectOption) CallOption + type CallOptions struct + Address []string + Backoff BackoffFunc + CallWrappers []CallWrapper + Context context.Context + DialTimeout time.Duration + RequestTimeout time.Duration + Retries int + Retry RetryFunc + SelectOptions []selector.SelectOption + type CallWrapper func(CallFunc) CallFunc + type Client interface + Call func(ctx context.Context, req Request, rsp interface{}, opts ...CallOption) error + Init func(...Option) error + NewMessage func(topic string, msg interface{}, opts ...MessageOption) Message + NewRequest func(service, endpoint string, req interface{}, reqOpts ...RequestOption) Request + Options func() Options + Publish func(ctx context.Context, msg Message, opts ...PublishOption) error + Stream func(ctx context.Context, req Request, opts ...CallOption) (Stream, error) + String func() string + func FromContext(ctx context.Context) (Client, bool) + func NewClient(opt ...Option) Client + type Message interface + ContentType func() string + Payload func() interface{} + Topic func() string + func NewMessage(topic string, payload interface{}, opts ...MessageOption) Message + type MessageOption func(*MessageOptions) + type MessageOptions struct + ContentType string + type Option func(*Options) + func Backoff(fn BackoffFunc) Option + func Broker(b broker.Broker) Option + func Codec(contentType string, c codec.NewCodec) Option + func ContentType(ct string) Option + func DialTimeout(d time.Duration) Option + func PoolSize(d int) Option + func PoolTTL(d time.Duration) Option + func Registry(r registry.Registry) Option + func RequestTimeout(d time.Duration) Option + func Retries(i int) Option + func Retry(fn RetryFunc) Option + func Selector(s selector.Selector) Option + func Transport(t transport.Transport) Option + func WithRouter(r Router) Option + func Wrap(w Wrapper) Option + func WrapCall(cw ...CallWrapper) Option + type Options struct + Broker broker.Broker + CallOptions CallOptions + Codecs map[string]codec.NewCodec + ContentType string + Context context.Context + PoolSize int + PoolTTL time.Duration + Registry registry.Registry + Router Router + Selector selector.Selector + Transport transport.Transport + Wrappers []Wrapper + type PublishOption func(*PublishOptions) + func WithExchange(e string) PublishOption + type PublishOptions struct + Context context.Context + Exchange string + type Request interface + Body func() interface{} + Codec func() codec.Writer + ContentType func() string + Endpoint func() string + Method func() string + Service func() string + Stream func() bool + func NewRequest(service, endpoint string, request interface{}, reqOpts ...RequestOption) Request + type RequestOption func(*RequestOptions) + func StreamingRequest() RequestOption + func WithContentType(ct string) RequestOption + type RequestOptions struct + ContentType string + Context context.Context + Stream bool + type Response interface + Codec func() codec.Reader + Header func() map[string]string + Read func() ([]byte, error) + type RetryFunc func(ctx context.Context, req Request, retryCount int, err error) (bool, error) + type Router interface + SendRequest func(context.Context, Request) (Response, error) + type Stream interface + Close func() error + Context func() context.Context + Error func() error + Recv func(interface{}) error + Request func() Request + Response func() Response + Send func(interface{}) error + func NewStream(ctx context.Context, request Request, opts ...CallOption) (Stream, error) + type StreamWrapper func(Stream) Stream + type Wrapper func(Client) Client