Documentation
¶
Index ¶
- Variables
- func DashboardFS() fs.FS
- func Migrate(ctx context.Context, driver store.Driver) error
- type BatchAckItem
- type BatchNackItem
- type Clock
- type CommitUnknownError
- type Deliveries
- type Delivery
- type DeliveryError
- type DeliveryErrorPage
- type DeliveryPage
- type DeliveryResult
- type LifecycleState
- type Message
- type MessageDeliveryStatus
- type MessageStatus
- type Options
- type PublishReceipt
- type PublishReceipts
- type Queue
- func (q *Queue) AckDelivery(ctx context.Context, topic Topic, subscriber, messageID, receipt string) error
- func (q *Queue) AckDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, ...) error
- func (q *Queue) BatchAckDeliveries(ctx context.Context, topic Topic, subscriber string, requests []BatchAckItem) []DeliveryResult
- func (q *Queue) BatchNackDeliveries(ctx context.Context, topic Topic, subscriber string, requests []BatchNackItem) []DeliveryResult
- func (q *Queue) BatchPublish(ctx context.Context, topic Topic, requests []Message) (PublishReceipts, error)
- func (q *Queue) BatchPublishAsync(ctx context.Context, topic Topic, requests []Message) (PublishReceipts, error)
- func (q *Queue) BatchPublishDurable(ctx context.Context, topic Topic, requests []Message) (PublishReceipts, error)
- func (q *Queue) BatchPublishTx(ctx context.Context, tx *sql.Tx, topic Topic, requests []Message) (PublishReceipts, error)
- func (q *Queue) CancelDelivery(ctx context.Context, topic Topic, subscriber, messageID, reason string) error
- func (q *Queue) CancelDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, ...) error
- func (q *Queue) CancelMessage(ctx context.Context, topic Topic, messageID, reason string) ([]DeliveryResult, error)
- func (q *Queue) CancelMessageTx(ctx context.Context, tx *sql.Tx, topic Topic, messageID, reason string) ([]DeliveryResult, error)
- func (q *Queue) Claim(ctx context.Context, topic Topic, subscriber string, limit int, ...) (Deliveries, error)
- func (q *Queue) ClaimWait(ctx context.Context, topic Topic, subscriber string, limit int, ...) (Deliveries, error)
- func (q *Queue) Close()
- func (q *Queue) CreateSchedule(ctx context.Context, topic Topic, input ScheduleInput) (Schedule, error)
- func (q *Queue) CreateSubscribers(ctx context.Context, topic Topic, subscribers Subscribers) error
- func (q *Queue) CreateTopic(ctx context.Context, topic Topic, subscribers Subscribers) error
- func (q *Queue) DeleteSchedule(ctx context.Context, topic Topic, scheduleID string) error
- func (q *Queue) DeleteSubscriber(ctx context.Context, topic Topic, subscriber string) error
- func (q *Queue) DeleteTopic(ctx context.Context, topic Topic) error
- func (q *Queue) DeliveryErrors(ctx context.Context, topic Topic, subscriber, messageID string, limit int, ...) (DeliveryErrorPage, error)
- func (q *Queue) ExtendLease(ctx context.Context, topic Topic, subscriber, messageID, receipt string, ...) (time.Time, error)
- func (q *Queue) GetMessageStatus(ctx context.Context, topic Topic, messageID string) (MessageStatus, error)
- func (q *Queue) GetSchedule(ctx context.Context, topic Topic, scheduleID string) (Schedule, error)
- func (q *Queue) GetSubscribersStatus(ctx context.Context, topic Topic) (SubscriberStatuses, error)
- func (q *Queue) GetTopic(topicName string) (Topic, bool)
- func (q *Queue) GetTopics(ctx context.Context, filter TopicFilter) (Topics, error)
- func (q *Queue) ListDeliveries(ctx context.Context, topic Topic, subscriber string, deadLetter bool, ...) (DeliveryPage, error)
- func (q *Queue) ListSchedules(ctx context.Context, topic Topic) ([]Schedule, error)
- func (q *Queue) Live() bool
- func (q *Queue) NackDelivery(ctx context.Context, topic Topic, subscriber, messageID, receipt string, ...) error
- func (q *Queue) NackDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, ...) error
- func (q *Queue) PauseSchedule(ctx context.Context, topic Topic, scheduleID string, paused bool) error
- func (q *Queue) PauseSubscriber(ctx context.Context, topic Topic, subscriber string) error
- func (q *Queue) PauseTopic(ctx context.Context, topic Topic) error
- func (q *Queue) Publish(ctx context.Context, topic Topic, request Message) (PublishReceipt, error)
- func (q *Queue) PublishAsync(ctx context.Context, topic Topic, request Message) (PublishReceipt, error)
- func (q *Queue) PublishDurable(ctx context.Context, topic Topic, request Message) (PublishReceipt, error)
- func (q *Queue) PublishTx(ctx context.Context, tx *sql.Tx, topic Topic, request Message) (PublishReceipt, error)
- func (q *Queue) Ready(ctx context.Context) bool
- func (q *Queue) ReplayDeadLetters(ctx context.Context, topic Topic, subscriber string, messageIDs []string) []DeliveryResult
- func (q *Queue) ResumeSubscriber(ctx context.Context, topic Topic, subscriber string) error
- func (q *Queue) ResumeTopic(ctx context.Context, topic Topic) error
- func (q *Queue) Run(ctx context.Context) error
- func (q *Queue) RunScheduleNow(ctx context.Context, topic Topic, scheduleID string, force bool) (ScheduleRun, error)
- func (q *Queue) ScheduleRunHistory(ctx context.Context, topic Topic, scheduleID string, limit int, cursor string) (ScheduleRunPage, error)
- func (q *Queue) Shutdown(ctx context.Context) error
- func (q *Queue) SnoozeDelivery(ctx context.Context, topic Topic, subscriber, messageID, receipt string, ...) (time.Time, error)
- func (q *Queue) SnoozeDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, ...) (time.Time, error)
- func (q *Queue) State() LifecycleState
- func (q *Queue) UpdateSchedule(ctx context.Context, topic Topic, scheduleID string, expectedVersion int, ...) (Schedule, error)
- func (q *Queue) WithTx(ctx context.Context, options *sql.TxOptions, fn func(*sql.Tx) error) error
- func (q *Queue) WriterHealthy() bool
- type RetryPolicy
- type Schedule
- type ScheduleInput
- type ScheduleRun
- type ScheduleRunPage
- type Subscriber
- type SubscriberOptions
- type SubscriberQueueStats
- type SubscriberStatus
- type SubscriberStatuses
- type Subscribers
- type Topic
- type TopicFilter
- type Topics
- type WriterOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrLeaseLost = errors.New("delivery lease lost") ErrDeliveryNotFound = errors.New("delivery not found") ErrInvalidReceipt = errors.New("receipt_token is required") ErrResourcePaused = errors.New("topic or subscriber is paused") )
var ( ErrTopicNotFound = errors.New("topic not found") ErrQueueNotRunning = errors.New("blockqueue is not running") ErrQueueStopping = errors.New("blockqueue is stopping") ErrNoActiveSubscriber = errors.New("topic has no active subscriber") ErrInvalidPublish = errors.New("invalid publish request") ErrInvalidTopic = errors.New("invalid topic") ErrInvalidSubscriber = errors.New("invalid subscriber") ErrResourceConflict = errors.New("resource already exists") )
var ( ErrScheduleNotFound = errors.New("schedule not found") ErrScheduleVersion = errors.New("stale schedule version") ErrScheduleOverlap = errors.New("previous schedule run is still active") ErrScheduleLeaseLost = errors.New("schedule lease lost") )
var ( ErrSubscriberNotFound = errors.New("subscriber not found") ErrSubscriberDeleted = errors.New("subscriber was deleted") )
var ( ErrWriterClosed = errors.New("writer closed") ErrPendingBudgetExceeded = errors.New("pending write budget exceeded") ErrWriterDrainTimeout = errors.New("writer shutdown with unpersisted messages") ErrIdempotencyConflict = errors.New("idempotency key conflicts with a different message") ErrCommitUnknown = errors.New("publish commit outcome unknown") )
var ErrDeliveryTerminal = errors.New("delivery is already terminal")
ErrDeliveryTerminal reports an attempted cancellation of a delivery that was already processed or dead-lettered.
var ErrInvalidTransaction = errors.New("invalid blockqueue transaction")
ErrInvalidTransaction reports a missing or otherwise unusable caller transaction.
var ErrMigrationChecksum = errors.New("migration checksum mismatch")
var ErrUnsupportedDialect = errors.New("unsupported database dialect")
Functions ¶
func DashboardFS ¶ added in v0.2.0
DashboardFS returns the embedded optional HTTP dashboard assets.
Types ¶
type BatchAckItem ¶ added in v0.2.0
type BatchNackItem ¶ added in v0.2.0
type CommitUnknownError ¶ added in v0.2.0
CommitUnknownError means the caller stopped waiting after admission. The writer still owns the messages and may already have committed them; callers can safely reconcile or retry using the included stable IDs/idempotency keys.
func (*CommitUnknownError) Error ¶ added in v0.2.0
func (err *CommitUnknownError) Error() string
func (*CommitUnknownError) Is ¶ added in v0.2.0
func (err *CommitUnknownError) Is(target error) bool
func (*CommitUnknownError) Unwrap ¶ added in v0.2.0
func (err *CommitUnknownError) Unwrap() error
type Deliveries ¶ added in v0.2.0
type Deliveries []Delivery
type Delivery ¶ added in v0.2.0
type Delivery struct {
ID string `json:"id"`
Message string `json:"message"`
Headers map[string]string `json:"headers,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Status string `json:"status,omitempty"`
DeliveryCount int `json:"delivery_count,omitempty"`
FailureCount int `json:"failure_count,omitempty"`
Priority int `json:"priority,omitempty"`
ReceiptToken string `json:"receipt_token,omitempty"`
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
VisibleAt time.Time `json:"visible_at"`
CreatedAt time.Time `json:"created_at"`
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
CancelReason string `json:"cancel_reason,omitempty"`
}
type DeliveryError ¶ added in v0.2.0
type DeliveryError struct {
ID string `db:"id" json:"id"`
MessageID string `db:"message_id" json:"message_id"`
SubscriberID string `db:"subscriber_id" json:"subscriber_id"`
FailureCount int `db:"failure_count" json:"failure_count"`
Error string `db:"error" json:"error"`
FailedAt time.Time `db:"failed_at" json:"failed_at"`
}
DeliveryError is an append-only record of one NACK or lease expiry. A DLQ replay resets the delivery failure count but does not erase prior records.
type DeliveryErrorPage ¶ added in v0.2.0
type DeliveryErrorPage struct {
Errors []DeliveryError `json:"errors"`
NextCursor string `json:"next_cursor,omitempty"`
}
DeliveryErrorPage is a cursor-paginated delivery failure history.
type DeliveryPage ¶ added in v0.2.0
type DeliveryPage struct {
Messages Deliveries `json:"messages"`
NextCursor string `json:"next_cursor,omitempty"`
}
type DeliveryResult ¶ added in v0.2.0
type LifecycleState ¶ added in v0.2.0
type LifecycleState uint32
const ( LifecycleNew LifecycleState = iota LifecycleRunning LifecycleStopping LifecycleStopped )
func (LifecycleState) String ¶ added in v0.2.0
func (s LifecycleState) String() string
type Message ¶ added in v0.2.0
type Message struct {
Message string `json:"message"`
Headers map[string]string `json:"headers,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
Priority int `json:"priority,omitempty"`
Delay string `json:"delay,omitempty"`
ScheduleAt string `json:"schedule_at,omitempty"`
}
type MessageDeliveryStatus ¶ added in v0.2.0
type MessageDeliveryStatus struct {
SubscriberID string `db:"subscriber_id" json:"subscriber_id"`
Subscriber string `db:"subscriber" json:"subscriber"`
Status string `db:"status" json:"status"`
DeliveryCount int `db:"delivery_count" json:"delivery_count"`
FailureCount int `db:"failure_count" json:"failure_count"`
VisibleAt time.Time `db:"visible_at" json:"visible_at"`
ProcessedAt *time.Time `db:"processed_at" json:"processed_at,omitempty"`
CancelledAt *time.Time `db:"cancelled_at" json:"cancelled_at,omitempty"`
CancelReason string `db:"cancel_reason" json:"cancel_reason,omitempty"`
}
MessageDeliveryStatus describes one subscriber's delivery state.
type MessageStatus ¶ added in v0.2.0
type MessageStatus struct {
ID string `json:"id"`
TopicID string `json:"topic_id"`
Message string `json:"message"`
Headers map[string]string `json:"headers,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
Priority int `json:"priority"`
ScheduledAt time.Time `json:"scheduled_at"`
CreatedAt time.Time `json:"created_at"`
Deliveries []MessageDeliveryStatus `json:"deliveries"`
}
MessageStatus is the canonical message and the current state of every subscriber delivery created with it.
type Options ¶ added in v0.2.0
type Options struct {
Writer WriterOptions
CheckpointInterval time.Duration // Default: 30s
RetentionPeriod time.Duration // Default: 7d
DeadLetterRetention time.Duration // Default: disabled; operators opt in explicitly
ScheduleRunRetention time.Duration // Default: 30d
ShutdownTimeout time.Duration // Default: 30s for Close
ReadinessBacklog int64 // Default: 90% of pending message budget
Clock Clock // Optional deterministic scheduler clock
DisableMetrics bool // Skip per-message metric updates on the hot path
MetricRegisterer prometheus.Registerer // Optional collector registry; defaults to Prometheus global registry
}
type PublishReceipt ¶ added in v0.2.0
type PublishReceipts ¶ added in v0.2.0
type PublishReceipts []PublishReceipt
type Queue ¶ added in v0.2.0
type Queue struct {
// contains filtered or unexported fields
}
Queue is the import-first BlockQueue engine. It owns the supplied database driver from construction until shutdown.
func (*Queue) AckDelivery ¶ added in v0.2.0
func (*Queue) AckDeliveryTx ¶ added in v0.2.0
func (q *Queue) AckDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, subscriber, messageID, receipt string) error
AckDeliveryTx atomically acknowledges a lease in a caller-owned transaction.
func (*Queue) BatchAckDeliveries ¶ added in v0.2.0
func (q *Queue) BatchAckDeliveries(ctx context.Context, topic Topic, subscriber string, requests []BatchAckItem) []DeliveryResult
func (*Queue) BatchNackDeliveries ¶ added in v0.2.0
func (q *Queue) BatchNackDeliveries(ctx context.Context, topic Topic, subscriber string, requests []BatchNackItem) []DeliveryResult
func (*Queue) BatchPublish ¶ added in v0.2.0
func (*Queue) BatchPublishAsync ¶ added in v0.2.0
func (*Queue) BatchPublishDurable ¶ added in v0.2.0
func (*Queue) BatchPublishTx ¶ added in v0.2.0
func (q *Queue) BatchPublishTx(ctx context.Context, tx *sql.Tx, topic Topic, requests []Message) (PublishReceipts, error)
BatchPublishTx validates the complete batch before writing it to tx.
func (*Queue) CancelDelivery ¶ added in v0.2.0
func (q *Queue) CancelDelivery(ctx context.Context, topic Topic, subscriber, messageID, reason string) error
CancelDelivery terminally cancels one subscriber delivery. Repeating a successful cancellation is idempotent.
func (*Queue) CancelDeliveryTx ¶ added in v0.2.0
func (q *Queue) CancelDeliveryTx(ctx context.Context, tx *sql.Tx, topic Topic, subscriber, messageID, reason string) error
CancelDeliveryTx is CancelDelivery within a caller-owned transaction.
func (*Queue) CancelMessage ¶ added in v0.2.0
func (q *Queue) CancelMessage(ctx context.Context, topic Topic, messageID, reason string) ([]DeliveryResult, error)
CancelMessage cancels every pending or delivered subscriber delivery for a canonical message and returns the resulting state per subscriber.
func (*Queue) CancelMessageTx ¶ added in v0.2.0
func (q *Queue) CancelMessageTx(ctx context.Context, tx *sql.Tx, topic Topic, messageID, reason string) ([]DeliveryResult, error)
CancelMessageTx is CancelMessage within a caller-owned transaction.
func (*Queue) Claim ¶ added in v0.2.0
func (q *Queue) Claim(ctx context.Context, topic Topic, subscriber string, limit int, lease time.Duration) (Deliveries, error)
Claim atomically leases visible deliveries in canonical priority order. Every redelivery receives a fresh receipt token.
func (*Queue) ClaimWait ¶ added in v0.2.0
func (q *Queue) ClaimWait(ctx context.Context, topic Topic, subscriber string, limit int, lease time.Duration) (Deliveries, error)
ClaimWait long-polls without a polling backoff. Its timer is reset to the earliest pending visibility or expired lease deadline stored in the DB.
func (*Queue) CreateSchedule ¶ added in v0.2.0
func (*Queue) CreateSubscribers ¶ added in v0.2.0
func (*Queue) CreateTopic ¶ added in v0.2.0
func (*Queue) DeleteSchedule ¶ added in v0.2.0
func (*Queue) DeleteSubscriber ¶ added in v0.2.0
func (*Queue) DeleteTopic ¶ added in v0.2.0
func (*Queue) DeliveryErrors ¶ added in v0.2.0
func (q *Queue) DeliveryErrors( ctx context.Context, topic Topic, subscriber, messageID string, limit int, cursor string, ) (DeliveryErrorPage, error)
DeliveryErrors returns append-only NACK and lease-expiry history newest first. The cursor is opaque and scoped to the selected delivery.
func (*Queue) ExtendLease ¶ added in v0.2.0
func (*Queue) GetMessageStatus ¶ added in v0.2.0
func (q *Queue) GetMessageStatus(ctx context.Context, topic Topic, messageID string) (MessageStatus, error)
GetMessageStatus returns a canonical message and all of its delivery states.
func (*Queue) GetSchedule ¶ added in v0.2.0
func (*Queue) GetSubscribersStatus ¶ added in v0.2.0
func (*Queue) ListDeliveries ¶ added in v0.2.0
func (*Queue) ListSchedules ¶ added in v0.2.0
func (*Queue) NackDelivery ¶ added in v0.2.0
func (*Queue) NackDeliveryTx ¶ added in v0.2.0
func (q *Queue) NackDeliveryTx( ctx context.Context, tx *sql.Tx, topic Topic, subscriber, messageID, receipt string, retryDelay time.Duration, errorText string, ) error
NackDeliveryTx atomically records a failed lease in a caller-owned transaction. A zero retryDelay selects the subscriber retry policy.
func (*Queue) PauseSchedule ¶ added in v0.2.0
func (*Queue) PauseSubscriber ¶ added in v0.2.0
func (*Queue) PauseTopic ¶ added in v0.2.0
func (*Queue) Publish ¶ added in v0.2.0
Publish is durable by default. A nil error means the canonical message and every subscriber delivery row committed successfully.
func (*Queue) PublishAsync ¶ added in v0.2.0
func (q *Queue) PublishAsync(ctx context.Context, topic Topic, request Message) (PublishReceipt, error)
PublishAsync returns the message identity at admission time. It is useful to Go callers that need the same receipt exposed by HTTP 202 responses.
func (*Queue) PublishDurable ¶ added in v0.2.0
func (q *Queue) PublishDurable(ctx context.Context, topic Topic, request Message) (PublishReceipt, error)
PublishDurable waits until the message and all subscriber delivery rows are committed. Duplicate is definitive in the returned receipt.
func (*Queue) PublishTx ¶ added in v0.2.0
func (q *Queue) PublishTx(ctx context.Context, tx *sql.Tx, topic Topic, request Message) (PublishReceipt, error)
PublishTx stages a canonical message and its fan-out in caller-owned tx. The caller owns commit or rollback; staged rows are not claimable before a successful commit.
func (*Queue) ReplayDeadLetters ¶ added in v0.2.0
func (*Queue) ResumeSubscriber ¶ added in v0.2.0
func (*Queue) ResumeTopic ¶ added in v0.2.0
func (*Queue) Run ¶ added in v0.2.0
Run validates durable state and builds the complete runtime snapshot before starting background workers.
func (*Queue) RunScheduleNow ¶ added in v0.2.0
func (*Queue) ScheduleRunHistory ¶ added in v0.2.0
func (*Queue) Shutdown ¶ added in v0.2.0
Shutdown stops admission, drains the writer, stops listeners and maintenance workers, performs the final checkpoint, and closes the database driver.
func (*Queue) SnoozeDelivery ¶ added in v0.2.0
func (q *Queue) SnoozeDelivery( ctx context.Context, topic Topic, subscriber, messageID, receipt string, delay time.Duration, ) (time.Time, error)
SnoozeDelivery returns an active lease to pending without recording a failure or consuming the subscriber's failure budget.
func (*Queue) SnoozeDeliveryTx ¶ added in v0.2.0
func (q *Queue) SnoozeDeliveryTx( ctx context.Context, tx *sql.Tx, topic Topic, subscriber, messageID, receipt string, delay time.Duration, ) (time.Time, error)
SnoozeDeliveryTx is SnoozeDelivery within a caller-owned transaction.
func (*Queue) State ¶ added in v0.2.0
func (q *Queue) State() LifecycleState
func (*Queue) UpdateSchedule ¶ added in v0.2.0
func (*Queue) WithTx ¶ added in v0.2.0
WithTx runs fn in a transaction owned by the queue. It is the preferred way to atomically change application tables and publish or complete deliveries: the queue can notify local waiters only after commit succeeds.
func (*Queue) WriterHealthy ¶ added in v0.2.0
type RetryPolicy ¶ added in v0.2.0
type RetryPolicy struct {
InitialDelay string `json:"initial_delay,omitempty"`
MaxDelay string `json:"max_delay,omitempty"`
Multiplier float64 `json:"multiplier,omitempty"`
Jitter float64 `json:"jitter,omitempty"`
}
RetryPolicy controls the delay applied after a NACK or expired lease. Empty fields use the documented exponential-backoff defaults.
type Schedule ¶ added in v0.2.0
type Schedule struct {
ID string `db:"id" json:"id"`
TopicID string `db:"topic_id" json:"topic_id"`
Name string `db:"name" json:"name"`
CronExpression string `db:"cron_expression" json:"cron"`
Timezone string `db:"timezone" json:"timezone"`
Message string `db:"message" json:"message"`
Headers string `db:"headers" json:"-"`
CorrelationID sql.NullString `db:"correlation_id" json:"-"`
Priority int `db:"priority" json:"priority"`
MisfirePolicy string `db:"misfire_policy" json:"misfire_policy"`
OverlapPolicy string `db:"overlap_policy" json:"overlap_policy"`
Paused bool `db:"paused" json:"paused"`
Version int `db:"version" json:"version"`
NextRunAt time.Time `db:"next_run_at" json:"next_run_at"`
OwnerID sql.NullString `db:"owner_id" json:"-"`
LeaseExpiresAt sql.NullTime `db:"lease_expires_at" json:"-"`
FencingToken int64 `db:"fencing_token" json:"-"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}
func (Schedule) MarshalJSON ¶ added in v0.2.0
func (Schedule) PublicHeaders ¶ added in v0.2.0
type ScheduleInput ¶ added in v0.2.0
type ScheduleInput struct {
Name string `json:"name"`
CronExpression string `json:"cron"`
Timezone string `json:"timezone,omitempty"`
Message string `json:"message"`
Headers map[string]string `json:"headers,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Priority int `json:"priority,omitempty"`
MisfirePolicy string `json:"misfire_policy,omitempty"`
OverlapPolicy string `json:"overlap_policy,omitempty"`
}
type ScheduleRun ¶ added in v0.2.0
type ScheduleRun struct {
ID string `db:"id" json:"id"`
ScheduleID string `db:"schedule_id" json:"schedule_id"`
MessageID sql.NullString `db:"message_id" json:"-"`
ScheduledFor time.Time `db:"scheduled_for" json:"scheduled_for"`
StartedAt time.Time `db:"started_at" json:"started_at"`
FinishedAt sql.NullTime `db:"finished_at" json:"-"`
Status string `db:"status" json:"status"`
Error sql.NullString `db:"error" json:"-"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}
func (ScheduleRun) MarshalJSON ¶ added in v0.2.0
func (run ScheduleRun) MarshalJSON() ([]byte, error)
type ScheduleRunPage ¶ added in v0.2.0
type ScheduleRunPage struct {
Runs []ScheduleRun `json:"runs"`
NextCursor string `json:"next_cursor,omitempty"`
}
type Subscriber ¶ added in v0.2.0
type Subscriber struct {
ID uuid.UUID `db:"id" json:"id"`
TopicID uuid.UUID `db:"topic_id" json:"topic_id"`
TopicName string `db:"topic_name" json:"topic_name,omitempty"`
Name string `db:"name" json:"name"`
Options SubscriberOptions `db:"option" json:"options"`
Paused bool `db:"paused" json:"paused"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
DeletedAt *time.Time `db:"deleted_at" json:"deleted_at,omitempty"`
}
func NewSubscriber ¶ added in v0.2.0
func NewSubscriber(topic Topic, name string, options SubscriberOptions) Subscriber
type SubscriberOptions ¶ added in v0.2.0
type SubscriberOptions struct {
MaxAttempts int `json:"max_attempts"`
VisibilityDuration string `json:"visibility_duration"`
DequeueBatchSize int `json:"dequeue_batch_size,omitempty"`
RetryPolicy RetryPolicy `json:"retry_policy,omitempty"`
}
func (*SubscriberOptions) Scan ¶ added in v0.2.0
func (options *SubscriberOptions) Scan(source any) error
type SubscriberQueueStats ¶
type SubscriberStatus ¶ added in v0.2.0
type SubscriberStatuses ¶ added in v0.2.0
type SubscriberStatuses []SubscriberStatus
type Subscribers ¶ added in v0.2.0
type Subscribers []Subscriber
type Topic ¶ added in v0.2.0
type TopicFilter ¶ added in v0.2.0
type WriterOptions ¶ added in v0.2.0
type WriterOptions struct {
BatchSize int
FlushInterval time.Duration
MaxPendingMessages int64
MaxPendingBytes int64
RetryMin time.Duration
RetryMax time.Duration
// contains filtered or unexported fields
}
WriterOptions controls batching and the weighted pending budget.
func DefaultWriterOptions ¶ added in v0.2.0
func DefaultWriterOptions() WriterOptions
Source Files
¶
- cron.go
- database_events.go
- db.go
- db_control.go
- db_delivery.go
- db_delivery_control.go
- db_helpers.go
- db_schedule.go
- db_sqlite.go
- db_writer.go
- delivery.go
- delivery_controls.go
- dialect.go
- lifecycle.go
- maintenance.go
- migrate.go
- publish.go
- queue.go
- retry.go
- schedule_types.go
- scheduler.go
- statement_cache.go
- subscriber_runtime.go
- topic_runtime.go
- topology.go
- transaction.go
- types.go
- ui_embed.go
- writer.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
blockqueue
command
|
|
|
example
|
|
|
basic
command
Package main demonstrates using BlockQueue as an imported Go library.
|
Package main demonstrates using BlockQueue as an imported Go library. |
|
transactional
command
Package main demonstrates transactional enqueueing and transactional delivery completion with BlockQueue and an application table in one SQLite database.
|
Package main demonstrates transactional enqueueing and transactional delivery completion with BlockQueue and an application table in one SQLite database. |
|
internal
|
|
|
testdb
Package testdb provides guarded, schema-isolated PostgreSQL databases for integration tests and benchmarks.
|
Package testdb provides guarded, schema-isolated PostgreSQL databases for integration tests and benchmarks. |
|
pkg
|
|
|
Package store defines the small database boundary used by BlockQueue.
|
Package store defines the small database boundary used by BlockQueue. |
|
postgres
Package postgres provides the production PostgreSQL storage driver.
|
Package postgres provides the production PostgreSQL storage driver. |
|
sqlite
Package sqlite provides the production SQLite storage driver.
|
Package sqlite provides the production SQLite storage driver. |
|
turso
Package turso provides experimental libSQL/Turso storage support.
|
Package turso provides experimental libSQL/Turso storage support. |