public static IMQConnection CriarConexaoMQ() { string connectionTypeName = Configuration.Create().GetSection("Message:Connection").Value; MQConnectionTypeEnum connectionType = Enum.Parse <MQConnectionTypeEnum>(connectionTypeName, true); Dominio.ConfigurationModel.MQConnection mqConnection = new Dominio.ConfigurationModel.MQConnection { ConnectionType = connectionType, Hostname = Configuration.Create().GetSection("ConnectionStrings:MQConnection:HostName").Value, Port = Convert.ToInt32(Configuration.Create().GetSection("ConnectionStrings:MQConnection:Port").Value), Username = Configuration.Create().GetSection("ConnectionStrings:MQConnection:Username").Value, Password = Configuration.Create().GetSection("ConnectionStrings:MQConnection:Password").Value }; return(CriarConexaoMQ(mqConnection.ConnectionType, mqConnection.Hostname, mqConnection.Port, mqConnection.Username, mqConnection.Password)); }
public static IMQConnection CriarConexaoMQ(MQConnectionTypeEnum ConnectionTypeEnum, string HostName, int Port, string UserName, string Password) { switch (ConnectionTypeEnum) { case MQConnectionTypeEnum.RabbitMQ: { return(CreateRabbitMQ(HostName, Port, UserName, Password)); } break; case MQConnectionTypeEnum.Kafka: { return(CreateKafka(HostName, UserName, Password)); } break; default: return(CreateRabbitMQ(HostName, Port, UserName, Password)); break; } }