Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broker ¶
type Broker interface { Publish(subject string, message []byte, msgID ...string) error Subscribe(subject string, group string, handler func([]byte) ([]byte, error)) error CreateStream(streamName, subject string, dedupWindow time.Duration) error }
Broker is the interface that wraps the methods for a message broker
type NATSBroker ¶
type NATSBroker struct {
// contains filtered or unexported fields
}
NATSBroker defines the structure of the NATS broker with Redis for deduplication
func MustNewNATSBroker ¶
func MustNewNATSBroker(url string, redisAddr string) *NATSBroker
MustNewNATSBroker creates a new NATS broker and panics if there's an error
func NewNATSBroker ¶
func NewNATSBroker(url string, redisAddr string) (*NATSBroker, error)
NewNATSBroker initializes the NATS broker and the Redis client
func (*NATSBroker) CreateStream ¶
func (n *NATSBroker) CreateStream(streamName, subject string, dedupWindow time.Duration) error
CreateStream creates a new stream with a deduplication window
Click to show internal directories.
Click to hide internal directories.