Documentation
¶
Overview ¶
Code generated by interfacer, DO NOT EDIT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackFunc ¶
CallbackFunc is a function that is called when a message is received This will not be called when there are no messages to process It receives a context and a slice of events, and returns a slice of integers representing the indices of the events that were successfully processed.
type ConsumerConfig ¶
type ConsumerConfig struct {
ConsumerName string // The name for the consumer
Topic string // The topic to listen on, e.g: events.books
FetchLimit int // The maximum number of messages to fetch per second
Callback CallbackFunc // The callback function to process messages
CallbackTimeout *time.Duration // Optional timeout for the callback function, defaults to 1 minute
Wait *time.Duration // Optional wait time for the consumer before fetching messages, defaults to 1 second
}
Configuration for a consumer.
type Queue ¶
type Queue interface {
// Runs a consumer by given configuration and callback function
// OBS: This function is blocking, so make sure to run it in a goroutine if
// you want to run other code in parallel.
// Returns an error if the consumer could not be created or updated.
Consume(config ConsumerConfig) error
// Publishes a message to the specified topic.
// The function accepts a variadic parameter for timeout duration, defaulting to 5 seconds if not provided.
Publish(topic string, message []byte, timeout ...time.Duration) error
}
Queue defines the public interface for queue.
Click to show internal directories.
Click to hide internal directories.