code: func redial(ctx context.Context, url string) chan chan session {
  	sessions := make(chan chan session)
  
  	go func() {
  		sess := make(chan session)
  		defer close(sessions)
  
  		for {
  			select {
  			case sessions <- sess:
  			case <-ctx.Done():
  				log.Println("shutting down session factory")
  				return
  			}
  
  			conn, err := amqp.Dial(url)
  			if err != nil {
  				log.Fatalf("cannot (re)dial: %v: %q", err, url)
  			}
  
  			ch, err := conn.Channel()
  			if err != nil {
  				log.Fatalf("cannot create channel: %v", err)
  			}
  
  			if err := ch.ExchangeDeclare(exchange, "fanout", false, true, false, false, nil); err != nil {
  				log.Fatalf("cannot declare fanout exchange: %v", err)
  			}
  
  			select {
  			case sess <- session{conn, ch}:
  			case <-ctx.Done():
  				log.Println("shutting down new session")
  				return
  			}
  		}
  	}()
  
  	return sessions
  }
docs: // redial continually connects to the URL, exiting the program when no longer possible