feat: [wip] - implement storage

This commit is contained in:
sujit
2024-10-19 10:29:30 +05:45
parent 2fb9dfb803
commit 8fef4e69cc
8 changed files with 176 additions and 109 deletions

13
ctx.go
View File

@@ -4,11 +4,9 @@ import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"fmt"
"net"
"os"
"time"
"github.com/oarkflow/xid"
@@ -17,17 +15,6 @@ import (
"github.com/oarkflow/mq/storage/memory"
)
type Task struct {
CreatedAt time.Time `json:"created_at"`
ProcessedAt time.Time `json:"processed_at"`
Expiry time.Time `json:"expiry"`
Error error `json:"error"`
ID string `json:"id"`
Topic string `json:"topic"`
Status string `json:"status"`
Payload json.RawMessage `json:"payload"`
}
type Handler func(context.Context, *Task) Result
func IsClosed(conn net.Conn) bool {