// NewPubSub returns RabbitMQ message publisher/subscriber.
NewPubSub returns RabbitMQ message publisher/subscriber.
// NewPubSub returns RabbitMQ message publisher / subscriber .
func NewPubSub(url, queue string, logger log.Logger) (PubSub, 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 := &pubsub{
		publisher: publisher{
			conn: conn,
			ch:   ch,
		},
		logger:        logger,
		subscriptions: make(map[string]map[string]subscription),
	}
	return ret, nil
}
func NewPubSub ( url , queue string , logger log . Logger ) ( PubSub , 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 := & pubsub { publisher : publisher { conn : conn , ch : ch , } , logger : logger , subscriptions : make ( map [ string ] map [ string ] subscription ) , } return ret , nil }
NewPubSub returns RabbitMQ message publisher/subscriber.
NewPubSub returns RabbitMQ message publisher / subscriber .