當前位置: 首頁>>代碼示例>>Java>>正文


Java RabbitAdmin.deleteQueue方法代碼示例

本文整理匯總了Java中org.springframework.amqp.rabbit.core.RabbitAdmin.deleteQueue方法的典型用法代碼示例。如果您正苦於以下問題:Java RabbitAdmin.deleteQueue方法的具體用法?Java RabbitAdmin.deleteQueue怎麽用?Java RabbitAdmin.deleteQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.amqp.rabbit.core.RabbitAdmin的用法示例。


在下文中一共展示了RabbitAdmin.deleteQueue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: declareQueue

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
@Override
public void declareQueue() throws IOException {

    RabbitAdmin rabbitAdmin = rabbitAdmin();

    try {
        rabbitAdmin.declareQueue(new Queue("demo2",false,false,false));
    }catch (Exception e){
        try {
            if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCause()).getReason()).getReplyCode()) {
                rabbitAdmin.deleteQueue("demo2");
                declareQueue();
            }
        }catch (Exception e1){
        }
        log.error("e 's value : {}", e);
    }


}
 
開發者ID:laidu,項目名稱:java-learn,代碼行數:21,代碼來源:SpringClientDemo.java

示例2: cleanUp

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
@After
public void cleanUp() {
	RabbitAdmin admin = new RabbitAdmin(rabbitTestSupport.getResource());
	admin.deleteQueue("binder.dataOut.default");
	admin.deleteQueue("binder.dataOut." + this.randomGroup);
	admin.deleteExchange("binder.dataOut");
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-samples,代碼行數:8,代碼來源:RabbitAndKafkaBinderApplicationTests.java

示例3: testConnect

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
@Test
public void testConnect() {
	RabbitAdmin admin = new RabbitAdmin(this.lqcf);
	Queue queue = new Queue(UUID.randomUUID().toString(), false, false, true);
	admin.declareQueue(queue);
	ConnectionFactory targetConnectionFactory = this.lqcf.getTargetConnectionFactory("[" + queue.getName() + "]");
	RabbitTemplate template = new RabbitTemplate(targetConnectionFactory);
	template.convertAndSend("", queue.getName(), "foo");
	assertThat(template.receiveAndConvert(queue.getName())).isEqualTo("foo");
	((CachingConnectionFactory) targetConnectionFactory).destroy();
	admin.deleteQueue(queue.getName());
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:13,代碼來源:LocalizedQueueConnectionFactoryIntegrationTests.java

示例4: tearDown

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
@After
public void tearDown() {
	if (context != null) {
		context.close();
		context = null;
	}
	RabbitAdmin admin = new RabbitAdmin(rabbitTestSupport.getResource());
	admin.deleteQueue("binder.input.default");
	admin.deleteQueue("binder.output.default");
	admin.deleteExchange("binder.input");
	admin.deleteExchange("binder.output");
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:13,代碼來源:RabbitBinderModuleTests.java

示例5: testBadUserDeclarationsFatal

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
@Test
public void testBadUserDeclarationsFatal() throws Exception {
	RabbitTestBinder binder = getBinder();
	ConfigurableApplicationContext context = binder.getApplicationContext();
	ConfigurableListableBeanFactory bf = context.getBeanFactory();
	bf.registerSingleton("testBadUserDeclarationsFatal", new Queue("testBadUserDeclarationsFatal", false));
	bf.registerSingleton("binder", binder);
	RabbitExchangeQueueProvisioner provisioner = TestUtils.getPropertyValue(binder, "binder.provisioningProvider",
			RabbitExchangeQueueProvisioner.class);
	bf.initializeBean(provisioner, "provisioner");
	bf.registerSingleton("provisioner", provisioner);
	context.addApplicationListener(provisioner);
	RabbitAdmin admin = new RabbitAdmin(rabbitAvailableRule.getResource());
	admin.declareQueue(new Queue("testBadUserDeclarationsFatal"));
	// reset the connection and configure the "user" admin to auto declare queues...
	rabbitAvailableRule.getResource().resetConnection();
	bf.initializeBean(admin, "rabbitAdmin");
	bf.registerSingleton("rabbitAdmin", admin);
	admin.afterPropertiesSet();
	// the mis-configured queue should be fatal
	Binding<?> binding = null;
	try {
		binding = binder.bindConsumer("input", "baddecls", this.createBindableChannel("input", new BindingProperties()), createConsumerProperties());
		fail("Expected exception");
	}
	catch (BinderException e) {
		assertThat(e.getCause()).isInstanceOf(AmqpIOException.class);
	}
	finally {
		admin.deleteQueue("testBadUserDeclarationsFatal");
		if (binding != null) {
			binding.unbind();
		}
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:36,代碼來源:RabbitBinderTests.java

示例6: cleaner

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
public static void cleaner() {
    RabbitAdmin admin = new RabbitAdmin(factory());
    admin.setAutoStartup(true);
    admin.deleteExchange("error.exchange");
    admin.deleteExchange("exception.exchange");
    admin.deleteQueue("recoverable.exception.messages.queue");
    admin.deleteQueue("unrecoverable.exception.messages.queue");
}
 
開發者ID:ctc-g,項目名稱:sinavi-jfw,代碼行數:9,代碼來源:TestQueueCleaner.java

示例7: retryCleaner

import org.springframework.amqp.rabbit.core.RabbitAdmin; //導入方法依賴的package包/類
public static void retryCleaner() {
    RabbitAdmin admin = new RabbitAdmin(factory());
    admin.setAutoStartup(true);
    admin.deleteExchange("retry.test.exchange");
    admin.deleteQueue("retry.test.queue");
}
 
開發者ID:ctc-g,項目名稱:sinavi-jfw,代碼行數:7,代碼來源:TestQueueCleaner.java


注:本文中的org.springframework.amqp.rabbit.core.RabbitAdmin.deleteQueue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。