本文整理汇总了Java中com.rabbitmq.client.Channel.queueDelete方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.queueDelete方法的具体用法?Java Channel.queueDelete怎么用?Java Channel.queueDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rabbitmq.client.Channel
的用法示例。
在下文中一共展示了Channel.queueDelete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import com.rabbitmq.client.Channel; //导入方法依赖的package包/类
@Override
public synchronized boolean stop() {
if (s_connection.isOpen()) {
for (final String subscriberId : s_subscribers.keySet()) {
final Ternary<String, Channel, EventSubscriber> subscriberDetails = s_subscribers.get(subscriberId);
final Channel channel = subscriberDetails.second();
try {
channel.queueDelete(subscriberId);
channel.abort();
} catch (final IOException ioe) {
s_logger.warn("Failed to delete queue: " + subscriberId + " on AMQP server due to " + ioe.getMessage());
}
}
}
closeConnection();
return true;
}
示例2: declareQueue
import com.rabbitmq.client.Channel; //导入方法依赖的package包/类
private void declareQueue(String queue) throws Exception {
Channel channel = sender.get().createChannel();
try {
channel.queueDelete(queue);
channel.queueDeclare(queue, false, true, true, null);
} finally {
channel.close();
}
Thread.sleep(500L);
}
示例3: declareQueue
import com.rabbitmq.client.Channel; //导入方法依赖的package包/类
/**
* 当重复声明同一名称队列时:
* 1、参数相同,"不作为"
* 2、参数不同,错误码406
* @throws IOException
*/
@Override
public void declareQueue() throws IOException {
Connection connection = connection(connectionFactory());
Channel channel = connection.createChannel();
try {
channel.queueDeclare("demo1",true,false,false,null);
}catch (IOException e){
if ("406".equals(((AMQImpl.Channel.Close) (((ShutdownSignalException)e.getCause())).getReason()).getReplyCode())){
channel = connection.createChannel();
channel.queueDelete("demo1");
channel.queueDeclare("demo1",false,false,false,null);
}
}
}