示例#1
0
// createAMQPPublisher creates an AMQPPublisher
func (p *Producer) createAMQPPublisher(mq *rabbitmq.RabbitMQ) (*rabbitmq.Producer, error) {
	// create connection properties
	exchange := rabbitmq.Exchange{
		Name: p.ExchangeName,
	}

	publishingOptions := rabbitmq.PublishingOptions{
		Tag:        p.Tag,
		RoutingKey: p.RoutingKey,
		Immediate:  false,
	}

	return mq.NewProducer(
		exchange,
		rabbitmq.Queue{},
		publishingOptions,
	)
}
示例#2
0
// createMaintenancePublisher creates a new maintenance queue for storing
// errored messages in a queue for later processing
func (l *Consumer) createMaintenancePublisher(rmq *rabbitmq.RabbitMQ) (*rabbitmq.Producer, error) {
	exchange := rabbitmq.Exchange{
		Name: "",
	}

	publishingOptions := rabbitmq.PublishingOptions{
		Tag:       fmt.Sprintf("%sWorkerConsumer", l.WorkerName),
		Immediate: false,
	}

	return rmq.NewProducer(
		exchange,
		rabbitmq.Queue{
			Name:    "BrokerMaintenanceQueue",
			Durable: true,
		},
		publishingOptions,
	)
}