// NewPublisher returns RabbitMQ message Publisher.
NewPublisher returns RabbitMQ message Publisher.
// NewPublisher returns RabbitMQ message Publisher .
func NewPublisher(url string) (Publisher, error) {
	endpoint := fmt.Sprintf("amqp://%s", url)
	conn, err := amqp.Dial(endpoint)
	if err != nil {
		return nil, err
	}
	ch, err := conn.Channel()
	if err != nil {
		return nil, err
	}
	if err := ch.ExchangeDeclare(exchangeName, amqp.ExchangeDirect, true, false, false, false, nil); err != nil {
		return nil, err
	}
	ret := &publisher{
		conn: conn,
		ch:   ch,
	}
	return ret, nil
}
func NewPublisher ( url string ) ( Publisher , error ) { endpoint := fmt . Sprintf ( " " , url ) conn , err := amqp . Dial ( endpoint ) if err != nil { return nil , err } ch , err := conn . Channel ( ) if err != nil { return nil , err } if err := ch . ExchangeDeclare ( exchangeName , amqp . ExchangeDirect , true , false , false , false , nil ) ; err != nil { return nil , err } ret := & publisher { conn : conn , ch : ch , } return ret , nil }
NewPublisher returns RabbitMQ message Publisher.
NewPublisher returns RabbitMQ message Publisher .