publisher

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublisherPlatformRabbitMQ     = options.PlatformRabbitMQ
	PublisherPlatformGooglePubSub = options.PlatformGooglePubSub
	PublisherPlatformSNS          = options.PlatformSNS
)
View Source
const (
	DefaultContentType = headerVal.ContentTypeJSON
)

Variables

View Source
var DefaultPublisherOption = func() *PublisherOption {
	return &PublisherOption{
		Middlewares: []interfaces.PublisherMiddlewareFunc{},
		PublisherID: uuid.New().String(),
	}
}

DefaultPublisherOption returns the default options for a publisher.

Functions

This section is empty.

Types

type PublisherOption

type PublisherOption struct {
	PublisherID             string
	Middlewares             []interfaces.PublisherMiddlewareFunc
	RabbitMQPublisherConfig *RabbitMQPublisherConfig // optional, only if using RabbitMQ
}

Option define the option property

type PublisherOptionFunc

type PublisherOptionFunc func(opt *PublisherOption)

PublisherOptionFunc used for option chaining

func WithMiddlewares

func WithMiddlewares(middlewares ...interfaces.PublisherMiddlewareFunc) PublisherOptionFunc

WithMiddlewares sets the middlewares for the publisher. It accepts one or more PublisherMiddlewareFunc functions as arguments. These functions are used to modify the behavior of the publisher. The middlewares are applied in the order they are provided.

func WithPublisherID

func WithPublisherID(id string) PublisherOptionFunc

WithPublisherID sets the publisher ID for the PublisherOption. It returns a PublisherOptionFunc that can be used to configure the PublisherOption.

func WithRabbitMQPublisherConfig

func WithRabbitMQPublisherConfig(rabbitMQOption *RabbitMQPublisherConfig) PublisherOptionFunc

WithRabbitMQPublisherConfig sets the RabbitMQ publisher configuration for the publisher option. It takes a RabbitMQPublisherConfig struct as input and returns a PublisherOptionFunc. The returned PublisherOptionFunc sets the RabbitMQPublisherConfig field of the PublisherOption struct.

type RabbitMQPublisherConfig

type RabbitMQPublisherConfig struct {
	// PublisherChannelPoolSize specifies the size of the channel pool for publishing messages.
	PublisherChannelPoolSize int

	// Conn is the RabbitMQ connection to be used by the publisher.
	Conn *amqp.Connection
}

RabbitMQPublisherConfig represents the configuration options for a RabbitMQ publisher.

Jump to

Keyboard shortcuts

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