Documentation ¶
Overview ¶
Package consumer implements command line crawl consumer from nsq.
Index ¶
- Variables
- func New(opts ...Option) *cli.App
- type App
- type Option
- func WithBefore(fnc func(*App) error) Option
- func WithCrawler(crawler crawl.Crawler) Option
- func WithCrawlerConstructor(fnc func(*App) crawl.Crawler) Option
- func WithHandler(name string, h crawl.Handler) Option
- func WithMiddlewares(middlewares ...crawl.Middleware) Option
- func WithSpiderConstructor(fnc func(*App) Spider) Option
- func WithSpiders(spiders ...Spider) Option
- type Spider
Constants ¶
This section is empty.
Variables ¶
View Source
var Flags = []cli.Flag{ clinsq.AddrFlag, clinsq.LookupAddrFlag, clinsq.TopicFlag, clinsq.ChannelFlag, &cli.IntFlag{ Name: "concurrency", Value: 100, EnvVars: []string{"CONCURRENCY"}, }, &cli.IntFlag{ Name: "timeout", Usage: "default timeout in seconds", Value: 30, EnvVars: []string{"TIMEOUT"}, }, }
Flags - Consumer app flags.
Functions ¶
Types ¶
type App ¶
type App struct { // Ctx - Cli context, set on action. Ctx *cli.Context // Queue - NSQ queue. Constructed on first Action() call. *nsqcrawl.Queue // contains filtered or unexported fields }
App - Consumer command line application structure.
type Option ¶
type Option func(*App)
Option - Consumer app option setter.
func WithBefore ¶
WithBefore - Overwrites flag checking before action.
func WithCrawler ¶
WithCrawler - Registers spider on a crawler.
func WithCrawlerConstructor ¶
WithCrawlerConstructor - Constructs a crawler on action.
func WithHandler ¶
WithHandler - Registers crawler handler. It has to be set after WithCrawler (if any).
func WithMiddlewares ¶
func WithMiddlewares(middlewares ...crawl.Middleware) Option
WithMiddlewares - Registers middlewares on a crawler. It has to be set after WithCrawler (if any).
func WithSpiderConstructor ¶
WithSpiderConstructor - Constructs a spider on action.
func WithSpiders ¶
WithSpiders - Registers spider on a crawler. It has to be set after WithCrawler (if any).
Click to show internal directories.
Click to hide internal directories.