queue api
This commit is contained in:
23
internal/entity/task.go
Normal file
23
internal/entity/task.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user