AMQP: Use a named topic exchange; prep for Activity Monitor.
Instead of using default (direct) exchange, declare a topic exchange "boulder" for all queues. This permits a pub/sub model.
This commit is contained in:
parent
63997f481b
commit
2b34b9f6eb
16
amqp-rpc.go
16
amqp-rpc.go
|
|
@ -24,7 +24,9 @@ import (
|
|||
// XXX: I *think* these constants are appropriate.
|
||||
// We will probably want to tweak these in the future.
|
||||
const (
|
||||
AmqpExchange = ""
|
||||
AmqpExchange = "boulder"
|
||||
AmqpExchangeType = "topic"
|
||||
AmqpInternal = false
|
||||
AmqpDurable = false
|
||||
AmqpDeleteUnused = false
|
||||
AmqpExclusive = false
|
||||
|
|
@ -48,6 +50,18 @@ func amqpConnect(url string) (ch *amqp.Channel, err error) {
|
|||
|
||||
// A simplified way to declare and subscribe to an AMQP queue
|
||||
func amqpSubscribe(ch *amqp.Channel, name string) (msgs <-chan amqp.Delivery, err error) {
|
||||
err = ch.ExchangeDeclare(
|
||||
AmqpExchange,
|
||||
AmqpExchangeType,
|
||||
AmqpDurable,
|
||||
AmqpDeleteUnused,
|
||||
AmqpInternal,
|
||||
AmqpNoWait,
|
||||
nil)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not declare exchange: %s", err)
|
||||
}
|
||||
|
||||
q, err := ch.QueueDeclare(
|
||||
name,
|
||||
AmqpDurable,
|
||||
|
|
|
|||
Loading…
Reference in New Issue