Thanks to visit codestin.com
Credit goes to pkg.go.dev

options

package
v1.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoQueueOption

type GoQueueOption struct {
	// NumberOfConsumer is the number of consumer/worker/goroutine that will be spawned in one GoQueue instance.
	NumberOfConsumer int
	// Consumer is the consumer implementation that will be used by the GoQueue instance.
	Consumer consumer.Consumer
	// Publisher is the publisher implementation that will be used by the GoQueue instance.
	Publisher publisher.Publisher
	// MessageHandler is the inbound message handler that will be used by the GoQueue instance.
	MessageHandler interfaces.InboundMessageHandler
}

GoQueueOption represents the options for configuring a GoQueue instance.

func DefaultGoQueueOption

func DefaultGoQueueOption() *GoQueueOption

type GoQueueOptionFunc

type GoQueueOptionFunc func(opt *GoQueueOption)

GoQueueOptionFunc used for option chaining

func WithConsumer

func WithConsumer(c consumer.Consumer) GoQueueOptionFunc

WithConsumer sets the consumer for the GoQueueOption. It takes a consumer.Consumer as a parameter and returns a GoQueueOptionFunc. The GoQueueOptionFunc sets the Consumer field of the GoQueueOption.

func WithMessageHandler

WithMessageHandler sets the inbound message handler for the GoQueueOption. The inbound message handler is responsible for processing incoming messages. It takes an instance of the interfaces.InboundMessageHandler interface as a parameter. Example usage:

WithMessageHandler(func(message interfaces.InboundMessage) {
  // Process the incoming message
})

func WithNumberOfConsumer

func WithNumberOfConsumer(n int) GoQueueOptionFunc

WithNumberOfConsumer sets the number of consumers for the GoQueue. It takes an integer value 'n' as input and updates the NumberOfConsumer field of the GoQueueOption struct. This option determines how many goroutines will be created to consume items from the queue concurrently.

func WithPublisher

func WithPublisher(p publisher.Publisher) GoQueueOptionFunc

WithPublisher sets the publisher for the GoQueueOption. It takes a publisher.Publisher as a parameter and returns a GoQueueOptionFunc. The returned GoQueueOptionFunc sets the Publisher field of the GoQueueOption to the provided publisher.

type Platform

type Platform string

Platform represents a platform in the system.

const (
	PlatformRabbitMQ     Platform = "rabbitmq"
	PlatformGooglePubSub Platform = "google_pubsub"
	PlatformSNS          Platform = "sns"
	PlatformSQS          Platform = "sqs"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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