Version: v4.2.0+incompatible Latest Latest

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

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




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client is the hystrix client implementation

func NewClient

func NewClient(opts ...Option) *Client

NewClient returns a new instance of hystrix Client

func (*Client) Delete

func (hhc *Client) Delete(url string, headers http.Header) (*http.Response, error)

Delete makes a HTTP DELETE request with provided URL

func (*Client) Do

func (hhc *Client) Do(request *http.Request) (*http.Response, error)

Do makes an HTTP request with the native `http.Do` interface

func (*Client) Get

func (hhc *Client) Get(url string, headers http.Header) (*http.Response, error)

Get makes a HTTP GET request to provided URL

func (*Client) Patch

func (hhc *Client) Patch(url string, body io.Reader, headers http.Header) (*http.Response, error)

Patch makes a HTTP PATCH request to provided URL and requestBody

func (*Client) Post

func (hhc *Client) Post(url string, body io.Reader, headers http.Header) (*http.Response, error)

Post makes a HTTP POST request to provided URL and requestBody

func (*Client) Put

func (hhc *Client) Put(url string, body io.Reader, headers http.Header) (*http.Response, error)

Put makes a HTTP PUT request to provided URL and requestBody

type Option

type Option func(*Client)

Option represents the hystrix client options

func WithCommandName

func WithCommandName(name string) Option

WithCommandName sets the hystrix command name

func WithErrorPercentThreshold

func WithErrorPercentThreshold(errorPercentThreshold int) Option

WithErrorPercentThreshold sets hystrix error percent threshold

func WithFallbackFunc

func WithFallbackFunc(fn fallbackFunc) Option

WithFallbackFunc sets the fallback function

func WithHTTPClient

func WithHTTPClient(client heimdall.Doer) Option

WithHTTPClient sets a custom http client for hystrix client

func WithHTTPTimeout

func WithHTTPTimeout(timeout time.Duration) Option

WithHTTPTimeout sets hystrix timeout

func WithHystrixTimeout

func WithHystrixTimeout(timeout time.Duration) Option

WithHystrixTimeout sets hystrix timeout

func WithMaxConcurrentRequests

func WithMaxConcurrentRequests(maxConcurrentRequests int) Option

WithMaxConcurrentRequests sets hystrix max concurrent requests

func WithRequestVolumeThreshold

func WithRequestVolumeThreshold(requestVolumeThreshold int) Option

WithRequestVolumeThreshold sets hystrix request volume threshold

func WithRetrier

func WithRetrier(retrier heimdall.Retriable) Option

WithRetrier sets the strategy for retrying

func WithRetryCount

func WithRetryCount(retryCount int) Option

WithRetryCount sets the retry count for the Client

func WithSleepWindow

func WithSleepWindow(sleepWindow int) Option

WithSleepWindow sets hystrix sleep window

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL