Documentation
¶
Index ¶
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 Sequin client
func NewClient ¶
func NewClient(token string, opts *ClientOptions) *Client
NewClient creates a new Sequin client
type ClientOptions ¶
type ClientOptions struct { BaseURL string // API base URL, defaults to "https://api.sequinstream.com/api" HTTPClient *http.Client // Custom HTTP client, optional Timeout time.Duration // HTTP client timeout, defaults to 30s }
ClientOptions configures the client behavior
type Message ¶
type Message struct { AckID string Record json.RawMessage }
Message represents a single message with its acknowledgment ID
type PrefetchingOptions ¶
type PrefetchingOptions struct { // BufferSize determines how many messages to prefetch. // Must be > 0. BufferSize int }
PrefetchingOptions configures message prefetching behavior.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor(client SequinClient, consumerGroup string, handler ProcessorFunc, opts ProcessorOptions) (*Processor, error)
type ProcessorFunc ¶
ProcessorFunc processes a batch of messages. It should return an error if processing fails.
If an error is returned, none of the messages in the batch will be acknowledged and they will be redelivered after the visibility timeout.
type ProcessorOptions ¶
type ProcessorOptions struct { // MaxBatchSize is the maximum number of messages to process in a single batch. // The processor will call ProcessorFunc with up to this many messages. // If zero, defaults to 1. MaxBatchSize int // FetchBatchSize is the number of messages to request from the server in a single call. // This can be larger than MaxBatchSize to improve throughput. // If zero, defaults to MaxBatchSize. FetchBatchSize int // MaxConcurrent is the maximum number of concurrent batch processors. // If zero, defaults to 1. MaxConcurrent int // Prefetching configures message prefetching behavior. // If nil, messages are processed immediately as they arrive. Prefetching *PrefetchingOptions // ErrorHandler is called when message processing fails. // If nil, errors are logged to stderr. ErrorHandler func(context.Context, []Message, error) }
ProcessorOptions configures the behavior of a Processor.
type ReceiveParams ¶
type ReceiveParams struct { BatchSize int `json:"batch_size,omitempty"` WaitFor int `json:"wait_for,omitempty"` // milliseconds }
ReceiveParams represents parameters for the receive request
type ReceiveResponse ¶
type ReceiveResponse struct { Data []struct { AckID string `json:"ack_id"` Data struct { Record json.RawMessage `json:"record"` } `json:"data"` } `json:"data"` }
ReceiveResponse represents the response from the receive endpoint
type SequinClient ¶
type SequinClient interface { Receive(ctx context.Context, consumerGroupID string, params *ReceiveParams) ([]Message, error) Ack(ctx context.Context, consumerGroupID string, ackIDs []string) error Nack(ctx context.Context, consumerGroupID string, ackIDs []string) error }
SequinClient defines the interface for Sequin client operations