handlers

package
v0.0.0-...-02879a1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrInternalError

func ErrInternalError(err error) render.Renderer

ErrInternalError return internal error

func ErrInvalidJobRequest

func ErrInvalidJobRequest(err error) render.Renderer

ErrInvalidJobRequest return invalid job request error

func ErrKafkaError

func ErrKafkaError(err error) render.Renderer

ErrKafkaError return kafka error

Types

type Correlation

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

Correlation a correlator entry

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

ErrResponse struct for http error responses

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

Render to render a http return code

type HandlerEventReq

type HandlerEventReq struct {
	EventUUID        string              `json:"event_uuid"`
	Method           string              `json:"method"`
	Path             string              `json:"path"`
	Headers          map[string][]string `json:"headers"`
	Body             []byte              `json:"body"`
	TransferEncoding []string            `json:"transfer_encoding"`
	Form             url.Values          `json:"form"`
}

HandlerEventReq a generic event struct for forwarding via an event queue embedded by handlers as a base structure

func CreateEventReq

func CreateEventReq(servicePath *string, w http.ResponseWriter, r *http.Request) (*HandlerEventReq, error)

CreateEventReq map event to event structure

func (*HandlerEventReq) GetBytes

func (hreq *HandlerEventReq) GetBytes() ([]byte, error)

GetBytes get event structure as json byte array

type Handlers

type Handlers struct {
}

Handlers smart proxy api handlers

func (*Handlers) AddCorrelator

func (h *Handlers) AddCorrelator(ccUUID string, respChan *chan jsonutils.JSONMap, evReq *HandlerEventReq) *Correlation

AddCorrelator adds UUID lookup for a request's response to be fed back to the requestor.

func (*Handlers) DeleteCorrelator

func (h *Handlers) DeleteCorrelator(ccUUID string)

DeleteCorrelator deletes the UUID/response channel

func (*Handlers) GetCorrelator

func (h *Handlers) GetCorrelator(ccUUID string) *Correlation

GetCorrelator Gets the response channel by request UUID

func (*Handlers) InitKafka

func (h *Handlers) InitKafka(service *jsonutils.JSONMap, kafkaCfg *jsonutils.JSONMap) *kafka.Writer

InitKafka - Initialise a kafka writer for service and topic

func (*Handlers) Kafka

func (h *Handlers) Kafka(service *jsonutils.JSONMap, kafkaCfg *jsonutils.JSONMap) http.Handler

Kafka Subrouter for Loosely Coupled queued requests via kafka

Jump to

Keyboard shortcuts

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