Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTimeout = time.Second
DefaultTimeout is the length a new worker will wait to get a task
Functions ¶
func ConsumeBench ¶
ConsumeBench is a benchmark helper for consumers
func ParallelPublishBench ¶
ParallelPublishBench benchmarks publisher.Publish in parallel
func PublishBench ¶
PublishBench benchmarks publisher.Publish
func RandomQueue ¶
func RandomQueue() string
RandomQueue generates a random queue name - most useful for testing
Types ¶
type Broker ¶
type Broker interface { // Close shuts down the broker Close() error // Consumer returns _a_ Consumer Consumer(queue string) (Consumer, error) // Publisher returns _a_ Publisher Publisher(queue string) (Publisher, error) // Len returns the length of a given queue Len(queue string) int }
Broker implements a high level interface that can provide Consumer or Publisher
type Consumer ¶
type Consumer interface { // Consume will consume the next available message or times out waiting. The // message must be acknowledged with Ack() or Nack() before // the next call to Consume unless EnableMultiAck is true. Consume(out interface{}) error // ConsumeAck will consume the next message and acknowledge // that the message has been received. This prevents the message // from being redelivered, and no call to Ack() or Nack() is needed. ConsumeAck(out interface{}) error // ConsumeTimeout will consume the next available message. The // message must be acknowledged with Ack() or Nack() before // the next call to Consume unless EnableMultiAck is true. ConsumeTimeout(out interface{}, timeout time.Duration) error // Ack will send an acknowledgement to the server that the // last message returned by Consume was processed. Ack() error // Nack will send a negative acknowledgement to the server that the // last message returned by Consume was not processed and should be // redelivered. If EnableMultiAck is true, then all messages up to // the last consumed one will be negatively acknowledged Nack() error // Close will shutdown the Consumer. Any messages that are still // in flight will be Nack'ed. Close() error }
Consumer is used to consume messages from a queue
type Pool ¶
A Pool is a set of workers that all function on the same queue
func (*Pool) AddWorkers ¶
AddWorkers changes the current number of workers in a pool
func (*Pool) TotalTimeSinceWork ¶
TotalTimeSinceWork returns the time since any worker has seen work
Source Files ¶
Click to show internal directories.
Click to hide internal directories.