http

package
v0.0.0-...-3fb6fb6 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMsg

type HTTPMsg interface {
	GetPayload() []byte

	GetDebugPath() string
	GetURL(endpoint string) string

	//static methods
	GetHeaders(conf HTTPSinkConf) map[string]string
	BatchURL(msgs []interface{}, endpoint string, version int) string
	BatchPayload(msgs []interface{}, version int) []byte
}

HTTPMsg is an interface which incoming data should implment for HttpSink to work

type HTTPSink

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

HTTPSink is Sink implementation which writes to HttpEndpoint

func GetHTTPSink

func GetHTTPSink(size int, conf HTTPSinkConf) *HTTPSink

GetHTTPSink method is public method used to create Instance of HTTPSink

func (*HTTPSink) BatchConsume

func (h *HTTPSink) BatchConsume(msgs []interface{}, version int)

BatchConsume is implementation of Sink interface Consume.

func (*HTTPSink) Clone

func (h *HTTPSink) Clone() core.Sink

Clone is implementation of Sink interface method. As HTTPSink is Stateless this method returns selfRefrence

func (*HTTPSink) Consume

func (h *HTTPSink) Consume(msg interface{}, retries int) error

Consume is implementation for Single message Consumption. This infinitely retries pre and post hooks, but finetly retries HTTPCall for status. status == true is determined by responseCode 2xx

func (*HTTPSink) RegisterHook

func (h *HTTPSink) RegisterHook(hook HTTPSinkHook)

type HTTPSinkConf

type HTTPSinkConf struct {
	Endpoint                    string              `json:"endpoint"` //http://destinationHost:port/prefixPath
	Timeout                     core.Duration       `json:"timeout"`
	RetryInterval               core.Duration       `json:"retry_interval"`
	Headers                     []map[string]string `json:"headers"`
	Method                      string              `json:"method"`                    //GET,POST,PUT,DELETE
	NonRetriableHttpStatusCodes []int               `json:nonRetriableHttpStatusCodes` //this is for handling customized errorCode thrown by sink

}

HTTPSinkConf holds config to HTTPSink

type HTTPSinkHook

type HTTPSinkHook interface {
	PreHTTPCall(msg interface{})
	PostHTTPCall(msg interface{}, sucess bool)
}

HTTPSinkHook is added for Clien to attach pre and post porcessing logic

Jump to

Keyboard shortcuts

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