transport

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcknowledgmentOption

type AcknowledgmentOption func(options map[string]interface{})

type ConsumeOpt added in v0.1.17

type ConsumeOpt func(options interface{}) error

type DeliveryDestination

type DeliveryDestination struct {
	DestinationTopic string
	RoutingKey       string
}

type IncomingPkg

type IncomingPkg interface {
	UID() string
	Origin() string
	Payload() []byte
	Headers() map[string]interface{}
	Ack(options ...AcknowledgmentOption) error
	Nack(options ...AcknowledgmentOption) error
	Reject(options ...AcknowledgmentOption) error
	ReceivedAt() time.Time
	PublishedAt() time.Time
}

type OutboundPkg

type OutboundPkg interface {
	Payload() []byte
	ContentType() string
	Headers() map[string]interface{}
	Destination() DeliveryDestination
}

func NewOutboundPkg

func NewOutboundPkg(payload []byte, contentType string, destination DeliveryDestination, headers map[string]interface{}) OutboundPkg

type Queue

type Queue interface {
	Name() string
}

type QueueBind

type QueueBind interface {
	DestinationTopic() string
	BindingKey() string
}

type SendOpt added in v0.1.17

type SendOpt func(options interface{}) error

type Topic

type Topic interface {
	Name() string
}

type Transport

type Transport interface {
	// CreateTopic creates a topic(exchange) in message broker
	CreateTopic(ctx context.Context, topic Topic) error
	// CreateQueue creates a queue in a message broker
	CreateQueue(ctx context.Context, queue Queue, queueBind ...QueueBind) error
	// Consume starts receiving packages in a goroutine and sends them to the <-chan IncomingPkg
	Consume(ctx context.Context, queues []Queue, options ...ConsumeOpt) (<-chan IncomingPkg, error)
	// Send sends an outbound package to a defined destination topic in OutboundPkg
	Send(ctx context.Context, outboundPkg OutboundPkg, options ...SendOpt) error
	// Disconnect disconnects from publishing and consuming channels
	Disconnect(context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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