queue

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActOption

type ActOption[T any] interface {
	// contains filtered or unexported methods
}

type ActOptionType

type ActOptionType interface {
	googlePubsubPubOption | natsPubsubPubOption
}

type GooglePubSubManager

type GooglePubSubManager interface {
	MustConnect() GooglePubSubManager
	Connect() error
	Dispose()

	Publish(ctx context.Context, topic string, packet Packet[any]) error
	PublishWithResult(ctx context.Context, topic string, packet Packet[any]) (*pubsub.PublishResult, error)
	PublishAndWaitAck(ctx context.Context, topic string, packet Packet[any]) (string, error)

	Subscribe(ctx context.Context, topic string, onReceivedMessage func(context.Context, *pubsub.Message)) error

	AckWithResult(ctx context.Context, id string, ackResult *pubsub.AckResult, result func(err error, status pubsub.AcknowledgeStatus))
}

func NewGooglePubSub

func NewGooglePubSub(projectId, scope string, tm telemetry.Manager, opts ...option.ClientOption) GooglePubSubManager

type Manager

type Manager[T any, POPT PublishOptionType] interface {
	MustConnect() Manager[T, POPT]
	Connect() error
	Dispose()

	Publish(ctx context.Context, topic string, packet Packet[any], opts ...PublishOption[POPT]) error
	Subscribe(ctx context.Context, topic string, onReceivedMessage func(context.Context, *T)) error

	Ack(ctx context.Context, id string, ackResult any, opts ...ActOption[any])
	NAck(ctx context.Context, id string, ackResult any, opts ...ActOption[any])
}

func NewPubSub

func NewPubSub(projectId, scope string, tm telemetry.Manager, opts ...option.ClientOption) Manager[pubsub.Message, googlePubsubPubOption]

type Option

type Option[T any] interface {
	// contains filtered or unexported methods
}

type Packet

type Packet[T any] struct {
	Key     string `json:"key"`
	Content T      `json:"content"`
}

func (*Packet[T]) FromJson

func (p *Packet[T]) FromJson(data []byte) Packet[T]

func (*Packet[T]) GetContent

func (p *Packet[T]) GetContent() T

func (*Packet[T]) ToByte

func (p *Packet[T]) ToByte() []byte

func (*Packet[T]) ToMap

func (p *Packet[T]) ToMap() map[string]interface{}

func (*Packet[T]) ToString

func (p *Packet[T]) ToString() string

type PublishOption

type PublishOption[T any] interface {
	// contains filtered or unexported methods
}

func GooglePubsubPubOptWithWaitAck

func GooglePubsubPubOptWithWaitAck(v bool, result func(string, error)) PublishOption[googlePubsubPubOption]

func GooglePubsubPubOptWithWaitResult

func GooglePubsubPubOptWithWaitResult(v bool, result func(*pubsub.PublishResult, error)) PublishOption[googlePubsubPubOption]

type PublishOptionType

type PublishOptionType interface {
	googlePubsubPubOption | natsPubsubPubOption
}

Jump to

Keyboard shortcuts

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