// RunUntilSignaled starts the server and run until we get something on closeChan func RunUntilSignaled(logger *blog.AuditLogger, server *rpc.AmqpRPCServer, closeChan chan *amqp.Error) { server.Start() fmt.Fprintf(os.Stderr, "Server running...\n") // Block until channel closes err := <-closeChan logger.Warning(fmt.Sprintf("AMQP Channel closed, will reconnect in 5 seconds: [%s]", err)) time.Sleep(time.Second * 5) logger.Warning("Reconnecting to AMQP...") }
// RunForever starts the server and wait around func RunForever(server *rpc.AmqpRPCServer) { forever := make(chan bool) server.Start() fmt.Fprintf(os.Stderr, "Server running...\n") <-forever }