rabbitmq笔记
作者:互联网
// 创建队列(包括参数) try { // 没有异常说明这个queue存在 rabbitTemplate.getConnectionFactory().createConnection().createChannel(false) .queueDeclarePassive(queueName); // continue; } catch (java.io.IOException e) { // 新建队列 rabbitTemplate.getConnectionFactory().createConnection().createChannel(false).queueDeclare(queueName, true, false, false, null); }
// 新建交换机 try { // 没有异常说明这个exchange存在 rabbitTemplate.getConnectionFactory().createConnection().createChannel(false) .exchangeDeclarePassive(exchange); } catch (java.io.IOException e) { // exchange不存在 rabbitTemplate.getConnectionFactory().createConnection().createChannel(false).exchangeDeclare(exchange, "topic", true); }
rabbitTemplate.getConnectionFactory().createConnection().createChannel(false).queueUnbind(originName, originExchange, key);
rabbitTemplate.getConnectionFactory().createConnection().createChannel(false).queueBind(queueName, exchange, key);
try { rabbitTemplate.getConnectionFactory().createConnection().createChannel(false).queueDelete(originName); } catch (AmqpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
标签:rabbitTemplate,false,exchange,笔记,createChannel,rabbitmq,getConnectionFactory,cre 来源: https://www.cnblogs.com/utomboy/p/12558281.html