Documentation
¶
Index ¶
- func HandleCleanupSessions(ctx context.Context, t *asynq.Task) error
- func HandleEmailSend(ctx context.Context, t *asynq.Task) error
- func HandleWelcomeEmail(ctx context.Context, t *asynq.Task) error
- type Config
- type EmailPayload
- type RedisContainer
- type Runtime
- func (r *Runtime) Enqueue(taskType string, payload interface{}, opts ...asynq.Option) error
- func (r *Runtime) EnqueueAt(at time.Time, taskType string, payload interface{}) error
- func (r *Runtime) EnqueueEmail(to, subject, body string) error
- func (r *Runtime) EnqueueIn(delay time.Duration, taskType string, payload interface{}) error
- func (r *Runtime) EnqueueWelcomeEmail(userID string) error
- func (r *Runtime) IsReady() bool
- func (r *Runtime) RegisterDefaults()
- func (r *Runtime) Shutdown()
- func (r *Runtime) Start() error
- func (r *Runtime) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleCleanupSessions ¶
HandleCleanupSessions removes expired sessions
func HandleEmailSend ¶
HandleEmailSend processes email sending jobs
Types ¶
type EmailPayload ¶
type EmailPayload struct {
To string `json:"to"`
Subject string `json:"subject"`
Body string `json:"body"`
}
EmailPayload represents email job data
type RedisContainer ¶
type RedisContainer struct {
// contains filtered or unexported fields
}
RedisContainer manages a Redis Docker container for testing
func StartRedisContainer ¶
func StartRedisContainer() (*RedisContainer, error)
StartRedisContainer starts a Redis container for testing
func (*RedisContainer) FlushAll ¶
func (rc *RedisContainer) FlushAll() error
FlushAll clears all data from Redis
func (*RedisContainer) URL ¶
func (rc *RedisContainer) URL() string
URL returns the Redis connection URL
type Runtime ¶
type Runtime struct {
Client *asynq.Client
Server *asynq.Server
Mux *asynq.ServeMux
// contains filtered or unexported fields
}
Runtime encapsulates the Asynq client, server, and mux
func NewRuntime ¶
NewRuntime creates a new job runtime
func (*Runtime) EnqueueEmail ¶
EnqueueEmail is a helper to enqueue an email job
func (*Runtime) EnqueueWelcomeEmail ¶
EnqueueWelcomeEmail enqueues a welcome email for a new user
func (*Runtime) IsReady ¶
IsReady checks if the runtime is properly initialized (has client and mux) without starting the server. This is useful for tests.
func (*Runtime) RegisterDefaults ¶
func (r *Runtime) RegisterDefaults()
RegisterDefaults registers default job handlers