broker

package
v0.0.0-...-41acbf8 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudEventsNATSHandler

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

CloudEventsNATSHandler handles CloudEvents publishing and NATS JetStream subscriptions.

func NewCloudEventsNATSHandler

func NewCloudEventsNATSHandler(natsURL, subject, stream string, isConsumer bool) (*CloudEventsNATSHandler, error)

func (*CloudEventsNATSHandler) Listen

func (h *CloudEventsNATSHandler) Listen(subject string, durableName string, handlerFunc func(msg *nats.Msg))

Listen subscribes to a NATS subject and processes messages with the provided handler function.

func (*CloudEventsNATSHandler) PublishEvent

func (h *CloudEventsNATSHandler) PublishEvent(ctx context.Context, subject string, data interface{}) error

PublishEvent sends a CloudEvent message.

type Message

type Message struct {
	Message   string    `json:"message"`
	Nick      string    `json:"nick"`
	Channel   string    `json:"channel"`
	Platform  string    `json:"platform"`
	Timestamp time.Time `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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