org.springframework.amqp.core.DirectExchange Java Examples
The following examples show how to use
org.springframework.amqp.core.DirectExchange.
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: DeadLetterQueueCreator.java From summerframework with Apache License 2.0 | 6 votes |
public void createDeadLetterQueue(String fromExchange, String byRouteKey, String delayOrRetryRouteKey, String sourceQueue, String delayOrRetryQueueName, Long ttl) { if (sourceQueue == null || sourceQueue.isEmpty()) { logger.warn( "Have not config destination Queue, will not create delay queue by automatic,may be you must maintain binding by youself"); return; } Properties properties = rabbitAdmin.getQueueProperties(delayOrRetryQueueName); if (properties == null) { Map<String, Object> delayQueueArgs = Maps.newHashMap(); delayQueueArgs.put("x-message-ttl", ttl); delayQueueArgs.put("x-dead-letter-exchange", fromExchange); delayQueueArgs.put("x-dead-letter-routing-key", byRouteKey); Queue delayQueue = new Queue(delayOrRetryQueueName, true, false, false, delayQueueArgs); String returnQueueName = rabbitAdmin.declareQueue(delayQueue); if (returnQueueName != null) { Binding binding = BindingBuilder.bind(delayQueue)// .to(new DirectExchange(DeadLetterConstant.DEFAULT_DEADLETTEREXCHANGE_NAME))// .with(delayOrRetryRouteKey);// rabbitAdmin.declareBinding(binding); } } }
Example #2
Source File: MQServiceTest.java From WeBASE-Front with Apache License 2.0 | 5 votes |
@Test public void testDeclareBind() { Binding bind = BindingBuilder.bind(new Queue(queueName)) .to(new DirectExchange(exchangeName)) .with(routingKey); rabbitAdmin.declareBinding(bind); }
Example #3
Source File: RabbitTemplateMessageQueueFactory.java From elasticactors with Apache License 2.0 | 5 votes |
private void ensureQueueExists(String queueName) { // ensure we have the queue created on the broker Queue queue = QueueBuilder.durable(queueName).build(); amqpAdmin.declareQueue(queue); // and bound to the exchange DirectExchange exchange = ExchangeBuilder.directExchange(exchangeName).build(); amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange).with(queueName)); }
Example #4
Source File: AmqpIntegration.java From building-microservices with Apache License 2.0 | 5 votes |
@Bean public InitializingBean prepareQueues(AmqpAdmin amqpAdmin) { return () -> { Queue queue = new Queue(this.echoQueueAndExchangeName, true); DirectExchange exchange = new DirectExchange(this.echoQueueAndExchangeName); Binding binding = BindingBuilder.bind(queue).to(exchange) .with(this.echoQueueAndExchangeName); amqpAdmin.declareQueue(queue); amqpAdmin.declareExchange(exchange); amqpAdmin.declareBinding(binding); }; }
Example #5
Source File: MessagingApplication.java From building-microservices with Apache License 2.0 | 5 votes |
@Bean public InitializingBean prepareQueues(AmqpAdmin amqpAdmin) { return () -> { Queue queue = new Queue(NOTIFICATIONS, true); DirectExchange exchange = new DirectExchange(NOTIFICATIONS); Binding binding = BindingBuilder.bind(queue).to(exchange).with(NOTIFICATIONS); amqpAdmin.declareQueue(queue); amqpAdmin.declareExchange(exchange); amqpAdmin.declareBinding(binding); }; }
Example #6
Source File: RabbitBinderTests.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 5 votes |
@Test public void testConsumerPropertiesWithUserInfrastructureNoBind() throws Exception { RabbitAdmin admin = new RabbitAdmin(this.rabbitAvailableRule.getResource()); Queue queue = new Queue("propsUser1.infra"); admin.declareQueue(queue); DirectExchange exchange = new DirectExchange("propsUser1"); admin.declareExchange(exchange); admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("foo")); RabbitTestBinder binder = getBinder(); ExtendedConsumerProperties<RabbitConsumerProperties> properties = createConsumerProperties(); properties.getExtension().setDeclareExchange(false); properties.getExtension().setBindQueue(false); Binding<MessageChannel> consumerBinding = binder.bindConsumer("propsUser1", "infra", createBindableChannel("input", new BindingProperties()), properties); Lifecycle endpoint = extractEndpoint(consumerBinding); SimpleMessageListenerContainer container = TestUtils.getPropertyValue(endpoint, "messageListenerContainer", SimpleMessageListenerContainer.class); assertThat(TestUtils.getPropertyValue(container, "missingQueuesFatal", Boolean.class)).isFalse(); assertThat(container.isRunning()).isTrue(); consumerBinding.unbind(); assertThat(container.isRunning()).isFalse(); Client client = new Client("http://guest:guest@localhost:15672/api/"); List<?> bindings = client.getBindingsBySource("/", exchange.getName()); assertThat(bindings.size()).isEqualTo(1); }
Example #7
Source File: RabbitMq4PayNotify.java From xxpay-master with MIT License | 5 votes |
@PostConstruct public void init() { DirectExchange exchange = new DirectExchange(PAY_NOTIFY_EXCHANGE_NAME); exchange.setDelayed(true); Queue queue = new Queue(PAY_NOTIFY_QUEUE_NAME); Binding binding = BindingBuilder.bind(queue).to(exchange).withQueueName(); amqpAdmin.declareExchange(exchange); amqpAdmin.declareQueue(queue); amqpAdmin.declareBinding(binding); }
Example #8
Source File: RabbitSinkTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 4 votes |
@Bean public DirectExchange exchange() { return new DirectExchange("scsapp-testex", false, true); }
Example #9
Source File: RabbitMQClient.java From kkbinlog with Apache License 2.0 | 4 votes |
public DirectExchange getNotifyExchange() { return notifyExchange; }
Example #10
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean public Binding commodityDataQueueBinding(DirectExchange commodityExchange, Queue commodityDataQueue) { return BindingBuilder.bind(commodityDataQueue).to(commodityExchange).with(COMMODITY_DATA_QUEUE); }
Example #11
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean public Binding counterPartyDataQueueBinding(DirectExchange commodityExchange, Queue counterPartyDataQueue) { return BindingBuilder.bind(counterPartyDataQueue).to(commodityExchange).with(COUNTER_PARTY_DATA_QUEUE); }
Example #12
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 #13
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean("tradeExchange") public DirectExchange tradeExchange() { return new DirectExchange(TRADE_EXCHANGE); }
Example #14
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean("tradeDataQueueBinding") public Binding tradeDataQueueBinding(@Qualifier("tradeDataQueue") Queue tradeDataQueue, DirectExchange tradeExchange) { return BindingBuilder.bind(tradeDataQueue).to(tradeExchange).withQueueName(); }
Example #15
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean("tradeCreateQueueBinding") public Binding tradeCreateQueueBinding(@Qualifier("tradeCreateQueue") Queue tradeCreateQueue, DirectExchange tradeExchange) { return BindingBuilder.bind(tradeCreateQueue).to(tradeExchange).withQueueName(); }
Example #16
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean("tradeUpdateQueueBinding") public Binding tradeUpdateQueueBinding(@Qualifier("tradeUpdateQueue") Queue tradeUpdateQueue, DirectExchange tradeExchange) { return BindingBuilder.bind(tradeUpdateQueue).to(tradeExchange).withQueueName(); }
Example #17
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean("tradeDeleteQueueBinding") public Binding tradeDeleteQueueBinding(@Qualifier("tradeDeleteQueue") Queue tradeDeleteQueue, DirectExchange tradeExchange) { return BindingBuilder.bind(tradeDeleteQueue).to(tradeExchange).withQueueName(); }
Example #18
Source File: DirectConfig.java From springboot-example with Apache License 2.0 | 4 votes |
@Bean Binding bindingExchangeDirectQueue(Queue directQueue, DirectExchange directExchange) { return BindingBuilder.bind(directQueue).to(directExchange).with(DirectConfig.QUEUE_NAME); }
Example #19
Source File: AmqpMessagingApplication.java From spring-cloud-contract with Apache License 2.0 | 4 votes |
@Bean public Binding binding() { return BindingBuilder.bind(new Queue("test.queue")) .to(new DirectExchange("contract-test.exchange")).with("#"); }
Example #20
Source File: DirectConfig.java From springboot-example with Apache License 2.0 | 4 votes |
@Bean DirectExchange directExchange() { // 参数一:交换器名称;参数二:是否持久化;参数三:是否自动删除消息 return new DirectExchange(DirectConfig.EXCHANGE_NAME, false, false); }
Example #21
Source File: AmqpConfig.java From articles with Apache License 2.0 | 4 votes |
@Bean public DirectExchange commodityExchange() { return new DirectExchange(REF_DATA_EXCHANGE); }
Example #22
Source File: RabbitMqConfiguration.java From spring-examples with GNU General Public License v3.0 | 4 votes |
@Bean public Binding binding(final Queue queue, final DirectExchange directExchange){ return BindingBuilder.bind(queue).to(directExchange).with(routingName); }
Example #23
Source File: RabbitMqConfiguration.java From spring-examples with GNU General Public License v3.0 | 4 votes |
@Bean public DirectExchange directExchange() { return new DirectExchange(exchangeName); }
Example #24
Source File: RetryTestConsumerContextConfig.java From sinavi-jfw with Apache License 2.0 | 4 votes |
@Bean @DependsOn("amqpAdmin") public Exchange retryTestExchange() { return new DirectExchange("retry.test.exchange"); }
Example #25
Source File: RabbitMQInitializerTest.java From sinavi-jfw with Apache License 2.0 | 4 votes |
@Bean public Exchange exchange() { return new DirectExchange("etest"); }
Example #26
Source File: SimpleDLQAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean DirectExchange messagesExchange() { return new DirectExchange(EXCHANGE_MESSAGES); }
Example #27
Source File: DLXParkingLotAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean DirectExchange messagesExchange() { return new DirectExchange(EXCHANGE_MESSAGES); }
Example #28
Source File: FatalExceptionStrategyAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean DirectExchange messagesExchange() { return new DirectExchange(EXCHANGE_MESSAGES); }
Example #29
Source File: DLXCustomAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean DirectExchange messagesExchange() { return new DirectExchange(EXCHANGE_MESSAGES); }
Example #30
Source File: RoutingKeyDLQAmqpConfiguration.java From tutorials with MIT License | 4 votes |
@Bean DirectExchange messagesExchange() { return new DirectExchange(EXCHANGE_MESSAGES); }