Documentation ¶
Index ¶
- func ConfigureTLS(nsqCfg *nsq.Config, tlsCfg *TLSConfig)
- func CreateNSQConfig(tlsCfg *TLSConfig) *nsq.Config
- func LoadCertificate(path string) (*tls.Certificate, error)
- func TTL(ttl time.Duration) crOption
- func Timeout(timeout time.Duration, timeoutFunction OnTimeout) crOption
- type Consumer
- type ConsumerRegistration
- type Level
- type OnTimeout
- type Option
- type Publisher
- type PublisherConfig
- type Receiver
- type TLSConfig
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureTLS ¶
func ConfigureTLS(nsqCfg *nsq.Config, tlsCfg *TLSConfig)
ConfigureTLS configures the given NSQ configuration for TLS connections.
func CreateNSQConfig ¶
func CreateNSQConfig(tlsCfg *TLSConfig) *nsq.Config
CreateNSQConfig creates and configures a TLS enabled (if given TLS config != nil) NSQ configuration.
func LoadCertificate ¶
func LoadCertificate(path string) (*tls.Certificate, error)
LoadCertificate reads file, divides into key and certificates
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
A Consumer wraps the base configuration for the nsq connection
func NewConsumer ¶
NewConsumer returns a consumer and stores the addresses of the lookupd's.
func (*Consumer) MustRegister ¶
func (c *Consumer) MustRegister(topic, channel string) *ConsumerRegistration
type ConsumerRegistration ¶
type ConsumerRegistration struct {
// contains filtered or unexported fields
}
type OnTimeout ¶
type OnTimeout func(err TimeoutError) error
OnTimeout function that is called in the case of timeout while handling the event
type Publisher ¶
type Publisher interface { Publish(topic string, data interface{}) error CreateTopic(topic string) error }
A Publisher is used for event publishing to topics. The fields Publish and CreateTopics can be overwritten to mock this publisher.
func NewPublisher ¶
func NewPublisher(zlog *zap.Logger, publisherCfg *PublisherConfig) (Publisher, error)
NewPublisher creates a new publisher to produce events for topics.
type PublisherConfig ¶
type PublisherConfig struct { TCPAddress string HTTPEndpoint string TLS *TLSConfig NSQ *nsq.Config }
A PublisherConfig represents the config of an NSQ publisher.
func (*PublisherConfig) ConfigureNSQ ¶
func (p *PublisherConfig) ConfigureNSQ()
ConfigureTLS configures the publisher regarding NSQ.
type Receiver ¶
type Receiver func(interface{}) error
A Receiver is a callback when you receive messages from the bus.
type TimeoutError ¶
type TimeoutError struct {
// contains filtered or unexported fields
}
func (TimeoutError) Error ¶
func (t TimeoutError) Error() string
func (TimeoutError) Event ¶
func (t TimeoutError) Event() interface{}