func New(config *config.Config) *Broker { broker := new(Broker) broker.cfg = config // Connect to the message queue server address := fmt.Sprintf("amqp://%s:%s@%s:%d/", config.GetQueueUsername(), config.GetQueuePassword(), config.GetQueueHost(), config.GetQueuePort()) conn, err := amqp.Dial(address) if err != nil { fmt.Printf("There was an error connecting to the broker") panic(err) } broker.conn = conn // Create a new channel channel, err := conn.Channel() if err != nil { panic(err) } broker.channel = channel broker.initializeQueues() return broker }