mqueue

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

type IRequestHandler interface {
	HandleRequest(IMessage) error
}

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 NewConfig

func NewConfig(topic, channel string, lookupd, nsqd []string) *NSQConfig

NewConfig ...

func (*NSQConfig) GetChannel

func (config *NSQConfig) GetChannel() string

GetChannel ...

func (*NSQConfig) GetDefaultRequeueDelay

func (config *NSQConfig) GetDefaultRequeueDelay() time.Duration

GetDefaultRequeueDelay ...

func (*NSQConfig) GetLookupdAddresses

func (config *NSQConfig) GetLookupdAddresses() []string

GetLookupdAddresses ...

func (*NSQConfig) GetMaxInflight

func (config *NSQConfig) GetMaxInflight() int

GetMaxInflight ...

func (*NSQConfig) GetNodeAddresses

func (config *NSQConfig) GetNodeAddresses() []string

GetNodeAddresses ...

func (*NSQConfig) GetProcessTimeout

func (config *NSQConfig) GetProcessTimeout() time.Duration

GetProcessTimeout sets the timeout for the application to process a message.

func (*NSQConfig) GetTopic

func (config *NSQConfig) GetTopic() string

GetTopic ...

func (*NSQConfig) HasLookupdAddresses

func (config *NSQConfig) HasLookupdAddresses() bool

HasLookupdAddresses returns true if there are lookupd addresses configured.

func (*NSQConfig) HasNodeAddresses

func (config *NSQConfig) HasNodeAddresses() bool

HasNodeAddresses returns true if there are NSQDaemon addresses configured.

func (*NSQConfig) SetMaxInflight

func (config *NSQConfig) SetMaxInflight(size int)

SetMaxInflight ...

func (*NSQConfig) SetRequeueDelay

func (config *NSQConfig) SetRequeueDelay(delay time.Duration)

SetRequeueDelay ...

type NSQConsumer

type NSQConsumer struct {
	// contains filtered or unexported fields
}

NSQConsumer ...

func NewNSQConsumer

func NewNSQConsumer(config *NSQConfig) *NSQConsumer

NewNSQConsumer ...

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.

func (*NSQConsumer) Start

func (consumer *NSQConsumer) Start() error

Start ...

func (*NSQConsumer) Stop

func (consumer *NSQConsumer) Stop() error

Stop stops the consumer.

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 NewNSQProducer

func NewNSQProducer(config *NSQConfig) *NSQProducer

NewNSQProducer ...

func (*NSQProducer) Output

func (producer *NSQProducer) Output(level int, msg string) error

Output used to log output for the underlying nsq producer.

func (*NSQProducer) Ping

func (producer *NSQProducer) Ping() error

Ping ...

func (*NSQProducer) Publish

func (producer *NSQProducer) Publish(topic string, body []byte, maxRetries int) error

Publish published a message on to a topic.

func (*NSQProducer) Stop

func (producer *NSQProducer) Stop()

Stop ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL