Documentation ¶
Index ¶
- type IMessage
- type IRequestHandler
- type NSQConfig
- func (config *NSQConfig) GetChannel() string
- func (config *NSQConfig) GetDefaultRequeueDelay() time.Duration
- func (config *NSQConfig) GetLookupdAddresses() []string
- func (config *NSQConfig) GetMaxInflight() int
- func (config *NSQConfig) GetNodeAddresses() []string
- func (config *NSQConfig) GetProcessTimeout() time.Duration
- func (config *NSQConfig) GetTopic() string
- func (config *NSQConfig) HasLookupdAddresses() bool
- func (config *NSQConfig) HasNodeAddresses() bool
- func (config *NSQConfig) SetMaxInflight(size int)
- func (config *NSQConfig) SetRequeueDelay(delay time.Duration)
- type NSQConsumer
- func (consumer *NSQConsumer) HandleMessage(nsqMsg *nsq.Message) error
- func (consumer *NSQConsumer) IsStarted() bool
- func (consumer *NSQConsumer) IsStopped() bool
- func (consumer *NSQConsumer) Output(level int, msg string) error
- func (consumer *NSQConsumer) SetHandler(handler IRequestHandler, concurrency uint) error
- func (consumer *NSQConsumer) SetLogger(l logger.Logger)
- func (consumer *NSQConsumer) Start() error
- func (consumer *NSQConsumer) Stop() error
- type NSQConsumerSimple
- type NSQProducer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMessage ¶
type IMessage interface { // GetID returns the unique identifier of this message in the underlying messaging system. GetID() string // GetContent returns the message payload in byte array format. GetContent() []byte // GetContentType returns the message's content type. GetContentType() string // GetRetries returns the number of times the message has been requeued (always 0 if unsupported by the protocol). GetRetries() uint // Requeue sends the message back to the queue to be processed after the default delay. Requeue() error // RequeueWithDelay is the same as requeue except it allows the delay to be specified. RequeueWithDelay(delay time.Duration) error // Processed marks the message as processed and removes it from the queue. Processed() error }
IMessage represents the internal message
type IRequestHandler ¶
IRequestHandler ...
type NSQConfig ¶
type NSQConfig struct { Lookupd []string `mapstructure:"lookupd"` Nsqd []string `mapstructure:"nsqd"` Topic string `mapstructure:"topic"` Channel string `mapstructure:"channel"` RequeueDelay int64 `mapstructure:"requeue_delay"` MaxInflight int `mapstructure:"max_inflight"` MaxAttempts uint16 `mapstructure:"max_attempts"` }
NSQConfig ...
func (*NSQConfig) GetDefaultRequeueDelay ¶
GetDefaultRequeueDelay ...
func (*NSQConfig) GetLookupdAddresses ¶
GetLookupdAddresses ...
func (*NSQConfig) GetNodeAddresses ¶
GetNodeAddresses ...
func (*NSQConfig) GetProcessTimeout ¶
GetProcessTimeout sets the timeout for the application to process a message.
func (*NSQConfig) HasLookupdAddresses ¶
HasLookupdAddresses returns true if there are lookupd addresses configured.
func (*NSQConfig) HasNodeAddresses ¶
HasNodeAddresses returns true if there are NSQDaemon addresses configured.
func (*NSQConfig) SetMaxInflight ¶
SetMaxInflight ...
func (*NSQConfig) SetRequeueDelay ¶
SetRequeueDelay ...
type NSQConsumer ¶
type NSQConsumer struct {
// contains filtered or unexported fields
}
NSQConsumer ...
func (*NSQConsumer) HandleMessage ¶
func (consumer *NSQConsumer) HandleMessage(nsqMsg *nsq.Message) error
HandleMessage ...
func (*NSQConsumer) IsStarted ¶
func (consumer *NSQConsumer) IsStarted() bool
IsStarted returns true if the consumer has been started.
func (*NSQConsumer) IsStopped ¶
func (consumer *NSQConsumer) IsStopped() bool
IsStopped returns true if the consumer has been stopped.
func (*NSQConsumer) Output ¶
func (consumer *NSQConsumer) Output(level int, msg string) error
Output implements the nsq.Logger interface Output method
func (*NSQConsumer) SetHandler ¶
func (consumer *NSQConsumer) SetHandler(handler IRequestHandler, concurrency uint) error
SetHandler ...
func (*NSQConsumer) SetLogger ¶ added in v0.2.2
func (consumer *NSQConsumer) SetLogger(l logger.Logger)
SetLogger changes the consumer's logger to something else.
type NSQConsumerSimple ¶
type NSQConsumerSimple struct { NSQConsumer // contains filtered or unexported fields }
NSQConsumerSimple is a basic consumer which performs only common operations.
func NewNSQConsumerSimple ¶
func NewNSQConsumerSimple(config *NSQConfig) *NSQConsumerSimple
NewNSQConsumerSimple creates a new instance of the NSQConsumerSimple.
func (*NSQConsumerSimple) HandleMessage ¶
func (consumer *NSQConsumerSimple) HandleMessage(msg *nsq.Message) error
HandleMessage required for integration with NSQ Consumer.
func (*NSQConsumerSimple) SetHandler ¶
func (consumer *NSQConsumerSimple) SetHandler(handler nsq.Handler, concurrency uint) error
SetHandler ...
func (*NSQConsumerSimple) Start ¶ added in v0.1.5
func (consumer *NSQConsumerSimple) Start() error
Start ...
type NSQProducer ¶
type NSQProducer struct {
// contains filtered or unexported fields
}
NSQProducer ...
func (*NSQProducer) Output ¶
func (producer *NSQProducer) Output(level int, msg string) error
Output used to log output for the underlying nsq producer.