Documentation
¶
Index ¶
Constants ¶
const ( PublisherPlatformRabbitMQ = options.PlatformRabbitMQ PublisherPlatformGooglePubSub = options.PlatformGooglePubSub PublisherPlatformSNS = options.PlatformSNS )
const (
DefaultContentType = headerVal.ContentTypeJSON
)
Variables ¶
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.