Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = &Config{ ExchangeName: "hop.exchange", Persistent: false, MaxConnectionRetry: 15 * time.Minute, }
DefaultConfig are the default values used when initializing the default queue.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ExchangeName is used when naming the underlying exchange for the work // queue. Please DO NOT use a pre-existing exchange name, as this would not // guarantee that the pre-existing exchange has the necessary properties // to provide work queue semantics. ExchangeName string // Persist indicates whether the underlying queues and messages should be // saved to disk to survive server restarts and crashes Persistent bool // MaxConnectionRetry indicates for how long dialing should be retried // during connection recovery MaxConnectionRetry time.Duration // AMQPConfig is optionally used to set up the internal connection to the // AMQP broker. If nil, default values (determined by the underlying // library) are used. AMQPConfig *amqp.Config }
Config represents a WorkQueue configuration.
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job represents a work unit taken from the work queue.
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
Topic represents a named "tube" from which jobs can be exclusively pulled and put into. Underneath, each topic corresponds to a queue bound to a direct exchange, and each topic instance manages its own channel.
func (*Topic) Put ¶
Put places a Job in the queue with the given body. Use PutPublishing if you need more control over your messages.
func (*Topic) PutPublishing ¶
func (t *Topic) PutPublishing(p *amqp.Publishing) error
PutPublishing puts an AMQP message into the queue. Use this if you need more granularity in your message parameters.
type WorkQueue ¶
type WorkQueue struct {
// contains filtered or unexported fields
}
WorkQueue is an abstraction over an AMQP connection that automatically performs management and configuration to provide easy work queue semantics.
func ConnectQueue ¶
ConnectQueue dials using the provided address string and creates a queue with the passed configuration.
func DefaultQueue ¶
DefaultQueue creates a queue with the default configuration and connection parameters.