name = params.get(NAME).toString();
}
if (params.containsKey(TYPE)) {
String type = params.containsKey(TYPE) ? params.get(TYPE).toString() : DIRECT;
if (DIRECT.equals(type)) {
exchange = new DirectExchange(name, durable, autoDelete, arguments);
} else if (TOPIC.equals(type)) {
exchange = new TopicExchange(name, durable, autoDelete, arguments);
} else if (FANOUT.equals(type)) {
exchange = new FanoutExchange(name, durable, autoDelete, arguments);
} else if (HEADERS.equals(type)) {
exchange = new HeadersExchange(name, durable, autoDelete, arguments);
} else {
exchange = new CustomExchange(name, type, durable, autoDelete, arguments);
}
currentExchange = exchange;
} else {
currentExchange = new DirectExchange(name);
}
try {
rabbitAdmin.declareExchange(currentExchange);
} catch (Exception e) {
log.error(e.getMessage(), e);