本文整理匯總了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);
}
}
}