private void Connect() { var rabbitHost = ConfigurationManager.AppSettings["RabbitMqHost"]; var rabbitUsername = ConfigurationManager.AppSettings["RabbitMqUsername"]; var rabbitPassword = ConfigurationManager.AppSettings["RabbitMqPassword"]; var factory = new ConnectionFactory { HostName = rabbitHost, UserName = rabbitUsername, Password = rabbitPassword, AutomaticRecoveryEnabled = true, RequestedHeartbeat = 30 }; Connection = factory.CreateConnection(); Connection.ConnectionShutdown += Connection_ConnectionShutdown; ChannelVariableList = Connection.CreateModel(); ChannelInfo = Connection.CreateModel(); ChannelState = Connection.CreateModel(); ChannelMessages = Connection.CreateModel(); ChannelTool = Connection.CreateModel(); ChannelHistoryJobPieceBar = Connection.CreateModel(); ChannelVariableList.QueueDeclare("VariableList", true, false, false, null); ChannelInfo.QueueDeclare("Info", true, false, false, null); ChannelState.QueueDeclare("State", true, false, false, null); ChannelMessages.QueueDeclare("Messages", true, false, false, null); ChannelTool.QueueDeclare("Tool", true, false, false, null); ChannelHistoryJobPieceBar.QueueDeclare("HistoryJobPieceBar", true, false, false, null); }