kncloudevents

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 108

Documentation

Index

Constants

View Source
const (
	DefaultShutdownTimeout = time.Minute * 1
)

Variables

This section is empty.

Functions

func ConfigureConnectionArgs added in v0.17.9

func ConfigureConnectionArgs(ca *ConnectionArgs)

ConfigureConnectionArgs configures the new connection args. The existing client won't be affected, but a new one will be created. Use sparingly, because it might lead to creating a lot of clients, none of them sharing their connection pool!

func CreateHandler added in v0.14.0

func CreateHandler(handler http.Handler) http.Handler

func PopulateSpan added in v0.19.0

func PopulateSpan(span *trace.Span) binding.TransformerFunc

func WithShutdownTimeout added in v0.14.0

func WithShutdownTimeout(ctx context.Context, timeout time.Duration) context.Context

func WriteHTTPRequestWithAdditionalHeaders added in v0.19.0

func WriteHTTPRequestWithAdditionalHeaders(ctx context.Context, message binding.Message, req *nethttp.Request,
	additionalHeaders nethttp.Header, transformers ...binding.Transformer) error

Types

type Backoff added in v0.17.0

type Backoff func(attemptNum int, resp *nethttp.Response) time.Duration

Backoff specifies a policy for how long to wait between retries. It is called after a failing request to determine the amount of time that should pass before trying again.

type CheckRetry added in v0.17.0

type CheckRetry func(ctx context.Context, resp *nethttp.Response, err error) (bool, error)

CheckRetry specifies a policy for handling retries. It is called following each request with the response and error values returned by the http.Client. If CheckRetry returns false, the Client stops retrying and returns the response to the caller. If CheckRetry returns an error, that error value is returned in lieu of the error from the request. The Client will close any response body when retrying, but if the retry is aborted it is up to the CheckRetry callback to properly close any response body before returning.

type ConnectionArgs added in v0.10.0

type ConnectionArgs struct {
	// MaxIdleConns refers to the max idle connections, as in net/http/transport.
	MaxIdleConns int
	// MaxIdleConnsPerHost refers to the max idle connections per host, as in net/http/transport.
	MaxIdleConnsPerHost int
}

ConnectionArgs allow to configure connection parameters to the underlying HTTP Client transport.

type HTTPMessageReceiver added in v0.19.0

type HTTPMessageReceiver struct {
	// contains filtered or unexported fields
}

func NewHTTPMessageReceiver added in v0.19.0

func NewHTTPMessageReceiver(port int, o ...HTTPMessageReceiverOption) *HTTPMessageReceiver

func (*HTTPMessageReceiver) StartListen added in v0.19.0

func (recv *HTTPMessageReceiver) StartListen(ctx context.Context, handler http.Handler) error

Blocking

type HTTPMessageReceiverOption added in v0.20.0

type HTTPMessageReceiverOption func(*HTTPMessageReceiver)

HTTPMessageReceiverOption enables further configuration of a HTTPMessageReceiver.

type HTTPMessageSender added in v0.19.0

type HTTPMessageSender struct {
	Client *nethttp.Client
	Target string
}

func NewHTTPMessageSender deprecated added in v0.19.0

func NewHTTPMessageSender(ca *ConnectionArgs, target string) (*HTTPMessageSender, error)

Deprecated: Don't use this anymore, now it has the same effect of NewHTTPMessageSenderWithTarget If you need to modify the connection args, use ConfigureConnectionArgs sparingly.

func NewHTTPMessageSenderWithTarget added in v0.19.0

func NewHTTPMessageSenderWithTarget(target string) (*HTTPMessageSender, error)

func (*HTTPMessageSender) NewCloudEventRequest added in v0.19.0

func (s *HTTPMessageSender) NewCloudEventRequest(ctx context.Context) (*nethttp.Request, error)

func (*HTTPMessageSender) NewCloudEventRequestWithTarget added in v0.19.0

func (s *HTTPMessageSender) NewCloudEventRequestWithTarget(ctx context.Context, target string) (*nethttp.Request, error)

func (*HTTPMessageSender) Send added in v0.19.0

func (*HTTPMessageSender) SendWithRetries added in v0.19.0

func (s *HTTPMessageSender) SendWithRetries(req *nethttp.Request, config *RetryConfig) (*nethttp.Response, error)

type RetryConfig added in v0.17.0

type RetryConfig struct {
	// Maximum number of retries
	RetryMax int
	// These next two variables are just copied from the original DeliverySpec so
	// we can detect if anything has changed. We can not do that with the CheckRetry
	// Backoff (at least not easily).
	BackoffDelay  *string
	BackoffPolicy *duckv1.BackoffPolicyType

	CheckRetry CheckRetry
	Backoff    Backoff
}

func NoRetries added in v0.17.0

func NoRetries() RetryConfig

func RetryConfigFromDeliverySpec added in v0.17.0

func RetryConfigFromDeliverySpec(spec duckv1.DeliverySpec) (RetryConfig, error)

type TypeExtractorTransformer added in v0.19.0

type TypeExtractorTransformer string

func (*TypeExtractorTransformer) Transform added in v0.19.0

Jump to

Keyboard shortcuts

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