queue api

This commit is contained in:
Aleksandr Trushkin
2024-02-03 18:15:26 +03:00
parent 6acb3dc199
commit 6044e116f8
3 changed files with 220 additions and 0 deletions

23
internal/entity/task.go Normal file
View File

@ -0,0 +1,23 @@
package entity
import (
"context"
"time"
)
type PublishParams struct {
Body []byte
ExpiresAt time.Time
}
type MessageQueue interface {
Publish(context.Context, PublishParams) (Task, error)
Consume(context.Context) (Task, error)
}
type Task struct {
ID uint64
CreatedAt time.Time
ExpiresAt *time.Time
Body []byte
}