snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s

This commit is contained in:
upstream-mirror
2026-09-15 21:27:46 +05:00
commit ce933d1277
538 changed files with 46504 additions and 0 deletions

32
tools/pq/cli/backend.go Normal file
View File

@@ -0,0 +1,32 @@
package cli
import (
"context"
"github.com/pkg/errors"
)
type BackendConfig struct {
Topic string
RawTopic string
}
func (c BackendConfig) Validate() error {
if c.Topic == "" && c.RawTopic == "" {
return errors.New("topic or raw topic must be provided")
}
if c.Topic != "" && c.RawTopic != "" {
return errors.New("only one of topic or raw topic must be provided")
}
return nil
}
type BackendConstructor func(ctx context.Context, cfg BackendConfig) (Backend, error)
type Backend interface {
AllMessages(ctx context.Context) ([]Message, error)
Requeue(ctx context.Context, msg Message) error
Ack(ctx context.Context, msg Message) error
}