cloudevents

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package cloudevents provides cloudevents client and server implementations.

Package cloudevents provides cloudevents client and server implementations.

Package cloudevents provides cloudevents client and server implementations.

Package cloudevents provides cloudevents client and server implementations.

Index

Constants

This section is empty.

Variables

View Source
var NewEvent = v2.NewEvent

Functions

func NewHttp

func NewHttp(address string, httpOption []http.Option, clientOption []cloudeventssdk_client.Option) (*client, error)

NewHttp creates and returns a http client.

ex) client, err := cloudevents.NewHttp(address, nil, nil)

Types

type Event

type Event = v2.Event

type Result

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

Result is the result of event delivery.

func NewHTTPResult

func NewHTTPResult(statusCode int, format string, arguments ...any) Result

NewResult creates and returns a result.

ex) result := cloudevents.NewHTTPResult(http.StatusOK, "")

func NewResult

func NewResult(format string, arguments ...any) Result

NewResult creates and returns a result.

ex) result := cloudevents.NewResult("ok")

func (*Result) Error

func (this *Result) Error() string

Error returns the error string.

ex) errString := result.Error()

func (*Result) GetHttpStatusCode

func (this *Result) GetHttpStatusCode() (int, error)

GetHttpStatusCode returns the status code if the result is http.

ex) statusCode, err := result.GetHttpStatusCode()

func (*Result) IsACK

func (this *Result) IsACK() bool

IsACK returns whether the recipient acknowledged the event.

ex) isACK := result.IsACK()

func (*Result) IsNACK

func (this *Result) IsNACK() bool

IsNACK returns whether the recipient did not acknowledge the event.

ex) isNACK := result.IsNACK()

func (*Result) IsUndelivered

func (this *Result) IsUndelivered() bool

IsUndelivered returns whether it was delivered or not.

ex) isUndelivered := result.IsUndelivered()

type Server

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

Server is a struct that provides server related methods.

func (*Server) Start

func (this *Server) Start(address string, handler func(Event) (*Event, Result), listenAndServeFailureFunc func(error)) error

Start is start the server.

ex) err := server.Start(address, handler, listenAndServeFailureFunc)

func (*Server) Stop

func (this *Server) Stop(shutdownTimeout time.Duration) error

Stop is stop the server.

ex) err := server.Stop(10)

Jump to

Keyboard shortcuts

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