From 74484f1821b90e0307f1be51b95a3d56367cae02 Mon Sep 17 00:00:00 2001 From: artaasadi Date: Fri, 13 Sep 2024 22:23:22 +0200 Subject: [PATCH] fix: add delete message to jq --- pkg/jq/nats.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/jq/nats.go b/pkg/jq/nats.go index 1141ed2..be5e311 100644 --- a/pkg/jq/nats.go +++ b/pkg/jq/nats.go @@ -147,3 +147,15 @@ func (jq *JobQueue) Produce(ctx context.Context, topic string, data []byte, id s return &pubAck.Sequence, nil } + +func (jq *JobQueue) DeleteMessage(ctx context.Context, streamName string, sequenceNumber uint64) error { + stream, err := jq.js.Stream(ctx, streamName) + if err != nil { + return err + } + err = stream.DeleteMsg(ctx, sequenceNumber) + if err != nil { + return err + } + return nil +}