mirror of
https://github.com/oarkflow/mq.git
synced 2025-10-04 15:42:49 +08:00
14 lines
236 B
Go
14 lines
236 B
Go
package mq
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
func NewTask(id string, payload json.RawMessage, nodeKey string) *Task {
|
|
if id == "" {
|
|
id = NewID()
|
|
}
|
|
return &Task{ID: id, Payload: payload, Topic: nodeKey, CreatedAt: time.Now()}
|
|
}
|