server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(ctx context.Context, cfg SetConfig) (*echo.Echo, error)

@description github.com/worldline-go/molen @description Authorization as "Bearer TOKEN" or use oauth2 login @BasePath /v1 @securityDefinitions.apikey ApiKeyAuth @in header @name Authorization @securityDefinitions.apikey ApiKeyAuth @in header @name Authorization @securitydefinitions.oauth2.accessCode OAuth2AccessCode @tokenUrl [[ .Custom.tokenUrl ]] @authorizationUrl [[ .Custom.authUrl ]]

func Start

func Start(e *echo.Echo) error

func Stop

func Stop(e *echo.Echo) error

Types

type APIRespond

type APIRespond struct {
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

type Handler

type Handler struct {
	Ctx            context.Context //nolint:containedctx // no need
	Client         *wkafka.Client
	ProduceMessage func(ctx context.Context, data ...Message) error
}

func (Handler) Publish

func (h Handler) Publish(c echo.Context) error

@Summary Publish message @Description Publish message(s) to kafka with topic and partition(optional) @Security ApiKeyAuth || OAuth2AccessCode @Router /publish [post] @Param topic query string true "topic name" @Param partition query int32 false "specific partition number" @Param key query string false "key" @Param payload body interface{} false "send key values" SchemaExample() @Param raw query bool false "raw body" @Accept application/json @Success 200 {object} APIRespond{} @failure 400 {object} APIRespond{} @failure 500 {object} APIRespond{}

type Message

type Message struct {
	Data      []byte
	Topic     string
	Partition int32
	Key       []byte
}

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

func (Message) ProducerHook

func (m Message) ProducerHook(r *wkafka.Record) *wkafka.Record

type SetConfig

type SetConfig struct {
	Client   *wkafka.Client
	Provider auth.InfProviderExtra
}

Jump to

Keyboard shortcuts

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