New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/harlow/go-queue

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/harlow/go-queue

  • v0.0.0-20150422014636-2725fda00657
  • Source
  • Go
  • Socket score

Version published
Created
Source

queue

The queue package wraps NSQ consumers to help reduce the amount of boilerplate that each program has to implement to get rolling. It does not attempt to abstract NSQ away entirely.

View the go-nsq documentation for configuration options.

Example

c := queue.NewConsumer("events", "ingestion")

c.Set("nsqd", ":5001")
c.Set("concurrency", 15)
c.Set("max_attempts", 10)
c.Set("max_in_flight", 150)
c.Set("default_requeue_delay", "15s")

c.Start(nsq.HandlerFunc(func(msg *nsq.Message) error {
  // do something
  return nil
}))

Usage

type Consumer
type Consumer struct {}

Consumer convenience layer.

func NewConsumer
func NewConsumer(topic, channel string) *Consumer

NewConsumer returns a new consumer of topic and channel.

func (*Consumer) Set
func (c *Consumer) Set(option string, value interface{})

Set option to value, any error will be returned in .Start().

Custom options implemented:

- `topic` consumer topic
- `channel` consumer channel
- `nsqd` nsqd address
- `nsqds` nsqd addresses
- `nsqlookupd` nsqlookupd address
- `nsqlookupds` nsqlookupd addresses
- `concurrency` concurrent handlers [1]
func (*Consumer) SetLogger
func (c *Consumer) SetLogger(log logger, level nsq.LogLevel)

SetLogger replaces the default logger.

func (*Consumer) Start
func (c *Consumer) Start(handler nsq.Handler) error

Start consumer with handler.

func (*Consumer) Stop
func (c *Consumer) Stop() error

Stop and wait.

License

MIT

FAQs

Package last updated on 22 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc