Documentation
¶
Index ¶
- Constants
- type Option
- type OptionFunc
- func WithActionsPatternSubscribed(actions ...string) OptionFunc
- func WithBatchMessageSize(n int) OptionFunc
- func WithConsumerID(id string) OptionFunc
- func WithMaxRetryFailedMessage(n int64) OptionFunc
- func WithMiddlewares(middlewares ...goqueue.InboundMessageHandlerMiddlewareFunc) OptionFunc
- func WithQueueName(name string) OptionFunc
- func WithTopicName(name string) OptionFunc
Constants ¶
const ( DefaultMaxRetryFailedMessage = 3 DefaultBatchMessageSize = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct {
// BatchMessageSize specifies the maximum number of messages to be processed in a single batch.
BatchMessageSize int
// QueueName specifies the name of the queue to consume messages from.
QueueName string
// Middlewares is a list of middleware functions to be applied to the inbound message handler.
Middlewares []goqueue.InboundMessageHandlerMiddlewareFunc
ActionsPatternSubscribed []string
TopicName string
MaxRetryFailedMessage int64
ConsumerID string
}
Option represents the configuration options for the consumer.
type OptionFunc ¶
type OptionFunc func(opt *Option)
OptionFunc is a function type that takes an `opt` parameter of type `*Option`. It is used as an option for configuring behavior in the `Option` struct.
func WithActionsPatternSubscribed ¶
func WithActionsPatternSubscribed(actions ...string) OptionFunc
WithActionsPatternSubscribed sets the actions that the consumer will subscribe to. It takes a variadic parameter `actions` which represents the actions to be subscribed. The actions are stored in the `ActionsPatternSubscribed` field of the `Option` struct.
func WithBatchMessageSize ¶
func WithBatchMessageSize(n int) OptionFunc
WithBatchMessageSize sets the batch message size option for the consumer. It takes an integer value 'n' and returns an OptionFunc that sets the BatchMessageSize field of the Option struct to 'n'.
func WithConsumerID ¶
func WithConsumerID(id string) OptionFunc
WithConsumerID sets the consumer ID for the consumer option.
func WithMaxRetryFailedMessage ¶
func WithMaxRetryFailedMessage(n int64) OptionFunc
WithMaxRetryFailedMessage sets the maximum number of retries for failed messages. It takes an integer parameter 'n' and returns an OptionFunc. The OptionFunc updates the 'MaxRetryFailedMessage' field of the Option struct.
func WithMiddlewares ¶
func WithMiddlewares(middlewares ...goqueue.InboundMessageHandlerMiddlewareFunc) OptionFunc
WithMiddlewares is an OptionFunc that sets the provided middlewares for the consumer. Middlewares are used to process inbound messages before they are handled by the consumer. The middlewares are applied in the order they are provided.
func WithQueueName ¶
func WithQueueName(name string) OptionFunc
WithQueueName sets the queue name for the consumer option.
func WithTopicName ¶
func WithTopicName(name string) OptionFunc
WithTopicName sets the topic name for the consumer option.