Versions in this module Expand all Collapse all v3 v3.13.1 Sep 21, 2022 Changes in this version + var DefaultBackoff = exponentialBackoff + var DefaultPoolSize = 100 + var DefaultPoolTTL = time.Minute + var DefaultRequestTimeout = time.Second * 10 + var DefaultRetries = 1 + var DefaultRetry = RetryOnConnectFailure + func Call(ctx context.Context, req Request, rsp interface{}, opts ...CallOption) error + func LookupRoute(ctx context.Context, req Request, opts CallOptions) ([]string, error) + func Publish(ctx context.Context, msg Message) error + func RetryAlways(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func RetryNever(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func RetryOnConnectFailure(ctx context.Context, req Request, retryCount int, err error) (bool, error) + func RetryOnError(ctx context.Context, req Request, retryCount int, err error) (bool, error) + type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error) + type CallFunc func(ctx context.Context, addr string, req Request, rsp interface{}, ...) error + type CallOption func(*CallOptions) + func WithAddress(a ...string) CallOption + func WithAuthToken() CallOption + func WithBackoff(fn BackoffFunc) CallOption + func WithCallWrapper(cw ...CallWrapper) CallOption + func WithDialTimeout(d time.Duration) CallOption + func WithNetwork(n string) CallOption + func WithRequestTimeout(d time.Duration) CallOption + func WithRetries(i int) CallOption + func WithRetry(fn RetryFunc) CallOption + func WithRouter(r router.Router) CallOption + func WithSelectOptions(sops ...selector.SelectOption) CallOption + func WithSelector(s selector.Selector) CallOption + func WithStreamTimeout(d time.Duration) CallOption + type CallOptions struct + Address []string + AuthToken bool + Backoff BackoffFunc + CallWrappers []CallWrapper + Context context.Context + DialTimeout time.Duration + Network string + RequestTimeout time.Duration + Retries int + Retry RetryFunc + Router router.Router + SelectOptions []selector.SelectOption + Selector selector.Selector + StreamTimeout time.Duration + 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 + var DefaultClient Client + type LookupFunc func(context.Context, Request, CallOptions) ([]string, error) + type Message interface + ContentType func() string + Payload func() interface{} + Topic func() string + func NewMessage(topic string, msg interface{}) Message + type MessageOption func(*MessageOptions) + func WithMessageContentType(ct string) MessageOption + 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 Lookup(l LookupFunc) Option + func PoolSize(d int) Option + func PoolTTL(d time.Duration) Option + func Proxy(addr string) Option + func Registry(r registry.Registry) Option + func RequestTimeout(d time.Duration) Option + func Retries(i int) Option + func Retry(fn RetryFunc) Option + func Router(r router.Router) Option + func Selector(s selector.Selector) Option + func StreamTimeout(d time.Duration) Option + func Transport(t transport.Transport) 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 + Lookup LookupFunc + PoolSize int + PoolTTL time.Duration + Proxy string + Router router.Router + Selector selector.Selector + Transport transport.Transport + Wrappers []Wrapper + func NewOptions(options ...Option) Options + type PublishOption func(*PublishOptions) + func PublishContext(ctx context.Context) PublishOption + 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, req interface{}, opts ...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 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 + type StreamWrapper func(Stream) Stream + type Wrapper func(Client) Client