Documentation
¶
Index ¶
- func NewConsumer(topic, channel, addr string, lookupAddr []string, concurrency int, ...) (*nsq.Consumer, error)
- func NewConsumerWithOpts(topic, channel, addr string, lookupAddr []string, concurrency, maxInFlight int, ...) (*nsq.Consumer, error)
- func NewProducer(addr string) (*nsqProducer, error)
- type ConsumerHandler
- type MsgHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConsumer ¶
func NewConsumer(topic, channel, addr string, lookupAddr []string, concurrency int, cb MsgHandler) (*nsq.Consumer, error)
* * @Description: 创建消费者实例 * @param: topic * @param: channel * @param: lookupAddr * @param: addr * @param: cb * @return: *nsq.Consumer * @return: error * @Author: Iori * @Date: 2022-04-25 14:24:32 *
func NewConsumerWithOpts ¶ added in v1.2.5
func NewConsumerWithOpts(topic, channel, addr string, lookupAddr []string, concurrency, maxInFlight int, lookupdPollInterval time.Duration, cb MsgHandler) (*nsq.Consumer, error)
NewConsumerWithOpts 创建消费者实例,支持配置 MaxInFlight 和 LookupdPollInterval。 maxInFlight<=0 时用默认值 2;lookupdPollInterval<=0 时用默认值 3s。
func NewProducer ¶
* * @Description: 初始化生产者 * @param: addr * @return: *nsqProducer * @return: error * @Author: Iori * @Date: 2022-04-22 14:05:53 *
Types ¶
type ConsumerHandler ¶
type ConsumerHandler struct {
// contains filtered or unexported fields
}
* nsqHandler * @Description: handler
func (*ConsumerHandler) HandleMessage ¶
func (ch *ConsumerHandler) HandleMessage(msg *nsq.Message) error
* * @Description: 处理消息函数 * @receiver: nh * @param: msg * @return: error * @Author: Iori * @Date: 2022-04-22 12:02:04 *
Click to show internal directories.
Click to hide internal directories.