Skip to content

Commit

Permalink
feat(jetstream): Add Response interface with NakWithDelay()
Browse files Browse the repository at this point in the history
  • Loading branch information
zapling committed Nov 3, 2024
1 parent 9df44d7 commit 541b0e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions jetstream/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ import (
var (
_ cone.Source = &Source{}
_ cone.Response = &responseAndEvent{}
_ Response = &responseAndEvent{}
)

type Response interface {
cone.Response
NakWithDelay(delay time.Duration) error
}

func New(consumer jetstream.Consumer, opts ...jetstream.PullConsumeOpt) *Source {
return &Source{consumer: consumer, opts: opts}
}
Expand Down Expand Up @@ -101,3 +107,10 @@ func (e *responseAndEvent) Nak() error {
e.responseSent = true
return e.m.Nak()
}

func (e *responseAndEvent) NakWithDelay(delay time.Duration) error {
if e.responseSent {
return nil
}
return e.m.NakWithDelay(delay)
}

0 comments on commit 541b0e4

Please sign in to comment.