Skip to content

Commit

Permalink
refactor: streams
Browse files Browse the repository at this point in the history
  • Loading branch information
w-h-a committed Jul 13, 2024
1 parent c59a715 commit ea4cd77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions streams/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type SubscribeOption func(o *SubscribeOptions)
type SubscribeOptions struct {
Group string
Topic string
AutoAck bool
AckWait time.Duration
RetryLimit int
Offset time.Time
Expand All @@ -56,9 +55,8 @@ func SubscribeWithTopic(t string) SubscribeOption {
}
}

func SubscribeWithAutoAck(autoAck bool, ackWait time.Duration) SubscribeOption {
func SubscribeWithAckWait(ackWait time.Duration) SubscribeOption {
return func(o *SubscribeOptions) {
o.AutoAck = autoAck
o.AckWait = ackWait
}
}
Expand All @@ -78,7 +76,6 @@ func SubscribeWithOffset(t time.Time) SubscribeOption {
func NewSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
options := SubscribeOptions{
Group: uuid.New().String(),
AutoAck: false,
AckWait: 16 * time.Second,
RetryLimit: 4,
Offset: time.Now().Add(time.Hour * -1),
Expand Down
1 change: 1 addition & 0 deletions streams/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package streams
type Subscriber interface {
Options() SubscribeOptions
Channel() chan Event
Close()
Ack(ev Event) interface{}
Nack(ev Event) interface{}
SetAttempts(c int, ev Event)
Expand Down

0 comments on commit ea4cd77

Please sign in to comment.