messaging

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPermament = errors.New("Permanent messaging error")
)

Functions

This section is empty.

Types

type DirectMessaging

type DirectMessaging interface {
	Listen(target string, handler func(data []byte)) (Subscription, error)
	Send(target string, data []byte) error
}

func NewNatsDirectMessaging

func NewNatsDirectMessaging(natsConn *nats.Conn) DirectMessaging

type EnqueueOptions

type EnqueueOptions struct {
	IdempotententKey string
}

type MessageQueue

type MessageQueue interface {
	Enqueue(topic string, message []byte, options *EnqueueOptions) error
	Dequeue(topic string, handler func(message []byte) error) error
	Close()
}

type NATsMessageQueueManager

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

func NewNATsMessageQueueManager

func NewNATsMessageQueueManager(queueName string, subjectWildCards []string, nc *nats.Conn) *NATsMessageQueueManager

func (*NATsMessageQueueManager) NewMessageQueue

func (m *NATsMessageQueueManager) NewMessageQueue(consumerName string) MessageQueue

type PubSub

type PubSub interface {
	Publish(topic string, message []byte) error
	PublishWithReply(ttopic, reply string, data []byte) error
	Subscribe(topic string, handler func(msg *nats.Msg)) (Subscription, error)
}

func NewNATSPubSub

func NewNATSPubSub(natsConn *nats.Conn) PubSub

type StreamPubsub

type StreamPubsub interface {
	Publish(topic string, message []byte) error
	Subscribe(name string, topic string, handler func(msg jetstream.Msg)) (Subscription, error)
}

func NewJetStreamPubSub

func NewJetStreamPubSub(natsConn *nats.Conn, streamName string, subjects []string, opts ...StreamPubsubOption) (StreamPubsub, error)

type StreamPubsubOption

type StreamPubsubOption func(*streamPubSubConfig)

func WithAckWait

func WithAckWait(ackWait time.Duration) StreamPubsubOption

func WithConsumerNamePrefix

func WithConsumerNamePrefix(prefix string) StreamPubsubOption

func WithDescription

func WithDescription(description string) StreamPubsubOption

func WithDiscardPolicy

func WithDiscardPolicy(policy nats.DiscardPolicy) StreamPubsubOption

func WithMaxAge

func WithMaxAge(maxAge time.Duration) StreamPubsubOption

func WithMaxDeliveryAttempts

func WithMaxDeliveryAttempts(maxAttempts int) StreamPubsubOption

func WithRetention

func WithRetention(policy nats.RetentionPolicy) StreamPubsubOption

func WithStorage

func WithStorage(storage nats.StorageType) StreamPubsubOption

type Subscription

type Subscription interface {
	Unsubscribe() error
}

Jump to

Keyboard shortcuts

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