org.springframework.amqp.core.Queue Java Examples
The following examples show how to use
org.springframework.amqp.core.Queue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageListenerRetryTest.java From sinavi-jfw with Apache License 2.0 | 6 votes |
@Test public void 回復可能例外の場合はデフォルトの指定回数リトライが実行されて回復可能例外キューに配信される() throws Exception { container.setQueues(ctx.getBean("retryTestQueue", Queue.class)); container.setMessageListener(new MessageListenerAdapter(new ApplicationRecoverableExceptionTestHandler(), ctx.getBean(MessageConverter.class))); recoverableContainer.setQueues(ctx.getBean("recoverableExceptionQueue", Queue.class)); recoverableContainer.setMessageListener(new MessageListenerAdapter(new RecoverableTestHandler(), ctx.getBean(MessageConverter.class))); container.start(); recoverableContainer.start(); template.convertAndSend("retry.test.exchange", "retry.test.binding", new RetryTestBean("test")); assertThat(retry.await(30, TimeUnit.SECONDS), is(true)); assertThat(retry.getCount(), is(0L)); assertThat(recover.await(3, TimeUnit.SECONDS), is(true)); assertThat(recover.getCount(), is(0L)); container.stop(); recoverableContainer.stop(); }
Example #2
Source File: EMSConfiguration.java From generic-vnfm with Apache License 2.0 | 6 votes |
@PostConstruct private void init() { log.info("Initialization of RabbitConfiguration"); emsConnectionFactory = new CachingConnectionFactory(); ((CachingConnectionFactory) emsConnectionFactory).setHost(brokerIp); ((CachingConnectionFactory) emsConnectionFactory).setPort(rabbitPort); ((CachingConnectionFactory) emsConnectionFactory).setUsername(emsRabbitUsername); ((CachingConnectionFactory) emsConnectionFactory).setPassword(emsRabbitPassword); rabbitAdmin = new RabbitAdmin(emsConnectionFactory); TopicExchange topicExchange = new TopicExchange("openbaton-exchange"); rabbitAdmin.declareExchange(topicExchange); log.info("exchange declared"); queueName_emsRegistrator = "ems." + vnfmHelper.getVnfmEndpoint() + ".register"; rabbitAdmin.declareQueue(new Queue(queueName_emsRegistrator, durable, exclusive, autodelete)); }
Example #3
Source File: RabbitMQConfig.java From konker-platform with Apache License 2.0 | 5 votes |
@Bean public Queue eventRoutesQueue() { boolean durable = true; boolean exclusive = false; boolean autoDelete = false; return new Queue("routed.events", durable, exclusive, autoDelete); }
Example #4
Source File: RabbitExchangeQueueProvisioner.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 5 votes |
private Binding declareConsumerBindings(String name, String routingKey, ExtendedConsumerProperties<RabbitConsumerProperties> properties, Exchange exchange, boolean partitioned, Queue queue) { if (partitioned) { return partitionedBinding(name, exchange, queue, routingKey, properties.getExtension(), properties.getInstanceIndex()); } else { return notPartitionedBinding(exchange, queue, routingKey, properties.getExtension()); } }
Example #5
Source File: SpringIntegrationTest.java From rabbitmq-mock with Apache License 2.0 | 5 votes |
private RabbitTemplate queueAndExchangeSetup(BeanFactory context) { RabbitAdmin rabbitAdmin = context.getBean(RabbitAdmin.class); Queue queue = new Queue(QUEUE_NAME, false); rabbitAdmin.declareQueue(queue); TopicExchange exchange = new TopicExchange(EXCHANGE_NAME); rabbitAdmin.declareExchange(exchange); rabbitAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("test.*")); return context.getBean(RabbitTemplate.class); }
Example #6
Source File: EventSubscriberConfiguration.java From articles with Apache License 2.0 | 5 votes |
@Bean public Queue eventReceivingQueue() { if (queueName == null) { throw new IllegalStateException("No queue to listen to! Please specify the name of the queue to listen to with the property 'subscriber.queue'"); } return new Queue(queueName); }
Example #7
Source File: RabbitBinderTests.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 5 votes |
@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(); } } }
Example #8
Source File: RabbitExchangeQueueProvisioner.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 4 votes |
/** * If so requested, declare the DLX/DLQ and bind it. The DLQ is bound to the DLX with * a routing key of the original queue name because we use default exchange routing by * queue name for the original message. * @param baseQueueName The base name for the queue (including the binder prefix, if * any). * @param routingKey The routing key for the queue. * @param properties the properties. */ private void autoBindDLQ(final String baseQueueName, String routingKey, RabbitCommonProperties properties) { boolean autoBindDlq = properties.isAutoBindDlq(); if (this.logger.isDebugEnabled()) { this.logger.debug("autoBindDLQ=" + autoBindDlq + " for: " + baseQueueName); } if (autoBindDlq) { String dlqName; if (properties.getDeadLetterQueueName() == null) { dlqName = constructDLQName(baseQueueName); } else { dlqName = properties.getDeadLetterQueueName(); } Queue dlq = new Queue(dlqName, true, false, false, queueArgs(dlqName, properties, true)); declareQueue(dlqName, dlq); String dlxName = deadLetterExchangeName(properties); if (properties.isDeclareDlx()) { declareExchange(dlxName, new ExchangeBuilder(dlxName, properties.getDeadLetterExchangeType()).durable(true) .build()); } Map<String, Object> arguments = new HashMap<>(properties.getDlqBindingArguments()); Binding dlqBinding = new Binding(dlq.getName(), DestinationType.QUEUE, dlxName, properties.getDeadLetterRoutingKey() == null ? routingKey : properties.getDeadLetterRoutingKey(), arguments); declareBinding(dlqName, dlqBinding); if (properties instanceof RabbitConsumerProperties && ((RabbitConsumerProperties) properties).isRepublishToDlq()) { /* * Also bind with the base queue name when republishToDlq is used, which * does not know about partitioning */ declareBinding(dlqName, new Binding(dlq.getName(), DestinationType.QUEUE, dlxName, baseQueueName, arguments)); } } }
Example #9
Source File: RabbitmqConfiguration.java From expper with GNU General Public License v3.0 | 4 votes |
@Bean Queue crawlArticleQueue() { return new Queue(QUEUE_GET_ARTICLE, false); }
Example #10
Source File: Tut6Config.java From java-tutorial with MIT License | 4 votes |
@Bean public Queue queue() { return new Queue("tut6.rpc.requests"); }
Example #11
Source File: DmfTestConfiguration.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
@Bean Queue replyToQueue() { return new Queue(ReplyToListener.REPLY_TO_QUEUE, false, false, true); }
Example #12
Source File: RabbitConfig.java From cloud-espm-cloud-native with Apache License 2.0 | 4 votes |
@Bean public Queue queue(){ return new Queue(queueName); }
Example #13
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean public Binding locationDataQueueBinding(DirectExchange commodityExchange, Queue locationDataQueue) { return BindingBuilder.bind(locationDataQueue).to(commodityExchange).with(LOCATION_DATA_QUEUE); }
Example #14
Source File: RabbitMQConfiguration.java From Learning-Path-Spring-5-End-to-End-Programming with MIT License | 4 votes |
@Bean("responsePaymentQueue") public Queue responsePaymentQueue() { return new Queue(this.responsePaymentQueue, true, false, false); }
Example #15
Source File: FanoutRabbitConfig.java From springboot-learning-experience with Apache License 2.0 | 4 votes |
@Bean Binding bindingExchangeB(Queue BMessage, FanoutExchange fanoutExchange) { return BindingBuilder.bind(BMessage).to(fanoutExchange); }
Example #16
Source File: RabbitConfiguration.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
@Bean public Queue webhookDeleteRequest() { return new Queue(QUEUE_WEBHOOK_DELETE_REQUEST); }
Example #17
Source File: Receiver.java From Learning-Path-Spring-5-End-to-End-Programming with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("SearchQ", false); }
Example #18
Source File: Sender.java From Learning-Path-Spring-5-End-to-End-Programming with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("CheckINQ", false); }
Example #19
Source File: RoutingKeyDLQAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean Queue deadLetterQueue() { return QueueBuilder.durable(QUEUE_MESSAGES_DLQ).build(); }
Example #20
Source File: AbstractRabbitMQConfiguration.java From abixen-platform with GNU Lesser General Public License v2.1 | 4 votes |
@Bean Queue queue() { return new Queue(queueName, false); }
Example #21
Source File: Sender.java From if1007 with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("CheckINQ", false); }
Example #22
Source File: RabbitConfiguration.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
@Bean public Queue patreonWebhookRequest() { return new Queue(QUEUE_PATREON_WEBHOOK_REQUEST); }
Example #23
Source File: AmqpApplication.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Bean public Queue queue() { return new Queue(QUEUE_NAME, false); }
Example #24
Source File: RabbitMQConfig.java From Spring-5.0-Cookbook with MIT License | 4 votes |
@Bean public Binding bindingAsync(DirectExchange exchange, Queue queue) { return BindingBuilder.bind(queue).to(exchange).with("packt"); }
Example #25
Source File: Receiver.java From Spring-Microservices with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("SearchQ", false); }
Example #26
Source File: MessageConsumerConfiguration.java From code-examples with MIT License | 4 votes |
@Bean public Queue queue() { return new Queue(QUEUE_NAME); }
Example #27
Source File: Receiver.java From Microservices-Building-Scalable-Software with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("SearchQ", false); }
Example #28
Source File: Application.java From Spring-Microservices with MIT License | 4 votes |
@Bean Queue queue() { return new Queue("TestQ", false); }
Example #29
Source File: SendRequestEventLogin.java From Spring-5.0-Cookbook with MIT License | 4 votes |
public SendRequestEventLogin(Queue queue, RabbitTemplate rabbitTemplate) { this.rabbitTemplate = rabbitTemplate; this.queue = queue; }
Example #30
Source File: RabbitMQConfig.java From iot-dc with Apache License 2.0 | 4 votes |
@Bean public Queue refreshQueue() { return new Queue("rtu_refresh_queue", true); }