org.springframework.amqp.core.Binding Java Examples

The following examples show how to use org.springframework.amqp.core.Binding. 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 vote down vote up
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: RabbitMq4PayNotify.java    From xxpay-master with MIT License 5 votes vote down vote up
@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 #3
Source File: MQServiceTest.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeclareBind() {
	Binding bind = BindingBuilder.bind(new Queue(queueName))
			.to(new DirectExchange(exchangeName))
			.with(routingKey);
	rabbitAdmin.declareBinding(bind);
}
 
Example #4
Source File: RabbitmqConfig.java    From cloud-service with MIT License 5 votes vote down vote up
/**
 * 将角色删除队列和用户的exchange做个绑定
 * 
 * @return
 */
@Bean
public Binding bindingRoleDelete() {
	Binding binding = BindingBuilder.bind(roleDeleteQueue()).to(userTopicExchange())
			.with(UserCenterMq.ROUTING_KEY_ROLE_DELETE);
	return binding;
}
 
Example #5
Source File: MessageConsumerConfiguration.java    From code-examples with MIT License 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
	return BindingBuilder
					.bind(eventReceivingQueue)
					.to(receiverExchange)
					.with("*.*");
}
 
Example #6
Source File: EventSubscriberConfiguration.java    From code-examples with MIT License 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
  if (routingKey == null) {
    throw new IllegalStateException("No events to listen to! Please specify the routing key for the events to listen to with the property 'subscriber.routingKey' (see EventPublisher for available routing keys).");
  }
  return BindingBuilder
          .bind(eventReceivingQueue)
          .to(receiverExchange)
          .with(routingKey);
}
 
Example #7
Source File: EventSubscriberConfiguration.java    From articles with Apache License 2.0 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
    if (routingKey == null) {
        throw new IllegalStateException("No events to listen to! Please specify the routing key for the events to listen to with the property 'subscriber.routingKey' (see EventPublisher for available routing keys).");
    }
    return BindingBuilder
            .bind(eventReceivingQueue)
            .to(receiverExchange)
            .with(routingKey);
}
 
Example #8
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingCleanInterceptorsCache() {

     return BindingBuilder.bind(queueCleanInterceptorsCache()).to(exchangeFanoutCleanInterceptorsCache());
}
 
Example #9
Source File: RabbitConfig.java    From blog_demos with Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingFanoutExchange(Queue fanoutQueue, FanoutExchange fanoutExchange) {
    return BindingBuilder.bind(fanoutQueue).to(fanoutExchange);
}
 
Example #10
Source File: RabbitMQConfig.java    From Spring-5.0-Cookbook with MIT License 4 votes vote down vote up
@Bean
public Binding bindingAsync(DirectExchange exchange, Queue queue) {
     return BindingBuilder.bind(queue).to(exchange).with("packt");
}
 
Example #11
Source File: RabbitMQConfigAsync.java    From Spring-5.0-Cookbook with MIT License 4 votes vote down vote up
@Bean
public Binding binding(DirectExchange exchange, Queue requestQueue) {
    return BindingBuilder.bind(requestQueue).to(exchange).with("packt.async");
}
 
Example #12
Source File: RabbitMQConfiguration.java    From Spring-5.0-By-Example with MIT License 4 votes vote down vote up
@Bean("paymentRequestBinding")
public Binding paymentRequestBinding(DirectExchange exchange,@Qualifier("paymentRequestQueue") Queue paymentRequestQueue){
  return BindingBuilder.bind(paymentRequestQueue).to(exchange).with(this.paymentRequestKey);
}
 
Example #13
Source File: RabbitMQConfiguration.java    From Spring-5.0-By-Example with MIT License 4 votes vote down vote up
@Bean("paymentResponseBinding")
public Binding paymentResponseBinding(DirectExchange exchange,@Qualifier("paymentResponseQueue") Queue paymentResponseQueue){
  return BindingBuilder.bind(paymentResponseQueue).to(exchange).with(this.paymentResponseKey);
}
 
Example #14
Source File: BusConfig.java    From SpringCloud with Apache License 2.0 4 votes vote down vote up
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    log.info("binding {} to {} with {}", queue, exchange, QUEUE_NAME);
    return BindingBuilder.bind(queue).to(exchange).with(QUEUE_NAME);
}
 
Example #15
Source File: AmqpConfig.java    From articles with Apache License 2.0 4 votes vote down vote up
@Bean("tradeUpdateQueueBinding")
public Binding tradeUpdateQueueBinding(@Qualifier("tradeUpdateQueue") Queue tradeUpdateQueue, DirectExchange tradeExchange) {
    return BindingBuilder.bind(tradeUpdateQueue).to(tradeExchange).withQueueName();
}
 
Example #16
Source File: AmqpConfig.java    From articles with Apache License 2.0 4 votes vote down vote up
@Bean("tradeDeleteQueueBinding")
public Binding tradeDeleteQueueBinding(@Qualifier("tradeDeleteQueue") Queue tradeDeleteQueue, DirectExchange tradeExchange) {
    return BindingBuilder.bind(tradeDeleteQueue).to(tradeExchange).withQueueName();
}
 
Example #17
Source File: MQConsumerConfig.java    From lemon-rabbitmq with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding binding(Queue queue, TopicExchange exchange){
    return BindingBuilder.bind(queue).to(exchange).with(routingkey);
}
 
Example #18
Source File: BusConfig.java    From SpringCloud with Apache License 2.0 4 votes vote down vote up
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY);
    return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}
 
Example #19
Source File: AmqpConfig.java    From myth with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding binding() {
    return BindingBuilder.bind(queue()).to(defaultExchange()).with(AmqpConfig.ROUTING_KEY);
}
 
Example #20
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingRemoveMiddlewares() {
     
     return BindingBuilder.bind(queueRemoveMiddlewares()).to(exchangeFanoutRemoveMiddlewares());
}
 
Example #21
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingMiddlewares() {
     
     return BindingBuilder.bind(queueMiddlewares()).to(exchangeFanoutMiddlewares());
}
 
Example #22
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingCachesClean() {
     
     return BindingBuilder.bind(queueCachesClean()).to(exchangeFanoutCleanAllCaches());
}
 
Example #23
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingRefreshAllInterceptors() {
     
     return BindingBuilder.bind(queueRefreshAllInterceptors()).to(exchangeFanoutRefreshAllInterceptors());
}
 
Example #24
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingInterceptors() {

     return BindingBuilder.bind(queueInterceptors()).to(exchangeFanoutAddInterceptors());
}
 
Example #25
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingRemoveInterceptors() {
     
     return BindingBuilder.bind(queueRemoveInterceptors()).to(exchangeFanoutRemoveInterceptors());
}
 
Example #26
Source File: RabbitConfiguration.java    From heimdall with Apache License 2.0 4 votes vote down vote up
@Bean
public Binding bindingRoutes() {

     return BindingBuilder.bind(queueRoutes()).to(exchangeFanoutRoutes());
}
 
Example #27
Source File: RabbitConfig.java    From iot-dc3 with Apache License 2.0 4 votes vote down vote up
@Bean
Binding pointValueBinding() {
    return BindingBuilder.bind(pointValueQueue()).to(exchange()).with("value.*");
}
 
Example #28
Source File: TopicRabbitConfig.java    From iot-dc3 with Apache License 2.0 4 votes vote down vote up
@Bean
Binding driverNotifyBinding() {
    return BindingBuilder.bind(driverNotifyQueue()).to(exchange()).with("driver." + this.serviceName);
}
 
Example #29
Source File: BusConfig.java    From JetfireCloud with Apache License 2.0 4 votes vote down vote up
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    log.info("binding {} to {} with {}", queue, exchange, QUEUE_NAME);
    return BindingBuilder.bind(queue).to(exchange).with(QUEUE_NAME);
}
 
Example #30
Source File: FanoutRabbitConfig.java    From springboot-learning-experience with Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingExchangeC(Queue CMessage, FanoutExchange fanoutExchange) {
    return BindingBuilder.bind(CMessage).to(fanoutExchange);
}