Documentation ¶
Index ¶
- type Client
- func (c Client) NewConsumer(ctx context.Context, p ProcessFunc) (*Consumer, error)
- func (c Client) NewConsumerWithOptions(ctx context.Context, p ProcessFunc, opts ConsumerOptions) (*Consumer, error)
- func (c Client) NewProducer(ctx context.Context) (*Producer, error)
- func (c Client) NewProducerWithOptions(ctx context.Context, opts ProducerOptions) (*Producer, error)
- type Consumer
- type ConsumerOptions
- type ProcessFunc
- type Producer
- type ProducerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client of the message queue. It can be used to spawn any number of consumers or producers.
func (Client) NewConsumer ¶
NewConsumer creates a new gq Consumer. It begins pulling messages immediately, and passes each one to the supplied process function
func (Client) NewConsumerWithOptions ¶ added in v0.1.5
func (c Client) NewConsumerWithOptions(ctx context.Context, p ProcessFunc, opts ConsumerOptions) (*Consumer, error)
NewConsumerWithOptions creates a new gq Consumer with the supplied options.
func (Client) NewProducer ¶
NewProducer creates a new gq Producer
func (Client) NewProducerWithOptions ¶ added in v0.1.5
func (c Client) NewProducerWithOptions(ctx context.Context, opts ProducerOptions) (*Producer, error)
NewProducerWithOptions creates a new gq Producer with the supplied options
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents a gq consumer
type ConsumerOptions ¶
type ConsumerOptions struct { // PullPeriod is the period messages should be pulled at (default: 50ms). // This can be tuned to achieve the desired throughput/latency tradeoff PullPeriod time.Duration // MaxPullSize is the maximum number of messages to be pulled in one batch (default: 50) MaxBatchSize int // MaxProcessingRetries is the maximum number of times that a message will be requeued for re-processing after processing fails (default: 3) MaxProcessingRetries int // Concurrency is the number of concurrent goroutines to pull messages from (default: num cpus) Concurrency int }
ConsumerOptions represents the options which can be used to tailor producer behaviour
type ProcessFunc ¶
ProcessFunc represents a function which is passed a message to process
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
Producer represents a message queue producer
type ProducerOptions ¶
type ProducerOptions struct { // PushPeriod is the period with which messages should be pushed (default: 50ms). // This can be tuned to achieve the desired throughput/latency tradeoff PushPeriod time.Duration // MaxRetryPeriods is the maximum number of push periods to retry a batch of messages for before discarding them (default: 3) MaxRetryPeriods int // Concurrency is the number of concurrent goroutines to push messages from (default: num cpus) Concurrency int }
ProducerOptions represents the options which can be used to tailor producer behaviour