events

package
v2.0.0-...-7f95631 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Id       string            `json:"id"`
	Channel  string            `json:"channel"`
	Metadata string            `json:"metadata"`
	Body     []byte            `json:"body"`
	Tags     map[string]string `json:"tags"`
}

func NewEvent

func NewEvent() *Event

func (*Event) SetBody

func (e *Event) SetBody(body []byte) *Event

func (*Event) SetChannel

func (e *Event) SetChannel(channel string) *Event

func (*Event) SetId

func (e *Event) SetId(id string) *Event

func (*Event) SetMetadata

func (e *Event) SetMetadata(metadata string) *Event

func (*Event) SetTags

func (e *Event) SetTags(tags map[string]string) *Event

type EventReceived

type EventReceived struct {
	Id           string
	FromClientId string
	Timestamp    time.Time
	Channel      string
	Metadata     string
	Body         []byte
	Tags         map[string]string
}

type EventsClient

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

func NewEventsClient

func NewEventsClient(kubemqClient pb.KubemqClient, clientId string) *EventsClient

func (*EventsClient) Send

func (e *EventsClient) Send(ctx context.Context, event *Event) error

func (*EventsClient) Subscribe

func (e *EventsClient) Subscribe(ctx context.Context, request *EventsSubscription, errCh chan error)

type EventsSubscription

type EventsSubscription struct {
	Channel        string
	Group          string
	OnReceiveEvent func(event *EventReceived)
	OnError        func(err error)
}

func NewEventsEventSubscription

func NewEventsEventSubscription() *EventsSubscription

func (*EventsSubscription) SetChannel

func (s *EventsSubscription) SetChannel(value string) *EventsSubscription

func (*EventsSubscription) SetGroup

func (s *EventsSubscription) SetGroup(value string) *EventsSubscription

func (*EventsSubscription) SetOnError

func (s *EventsSubscription) SetOnError(value func(err error)) *EventsSubscription

func (*EventsSubscription) SetOnReceiveEvent

func (s *EventsSubscription) SetOnReceiveEvent(fn func(event *EventReceived)) *EventsSubscription

func (*EventsSubscription) Validate

func (s *EventsSubscription) Validate() error

Jump to

Keyboard shortcuts

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