Refine search
public static DestinationConfigurer bind(Exchange exchange) { return new DestinationConfigurer(exchange.getName(), DestinationType.EXCHANGE); }
public static DestinationConfigurer bind(Queue queue) { return new DestinationConfigurer(queue.getName(), DestinationType.QUEUE); }
@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); }
@Test public void fanoutBinding() { FanoutExchange fanoutExchange = new FanoutExchange("f"); Binding binding = BindingBuilder.bind(queue).to(fanoutExchange); assertNotNull(binding); assertEquals(fanoutExchange.getName(), binding.getExchange()); assertEquals("", binding.getRoutingKey()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); }
@Test public void topicBinding() { TopicExchange topicExchange = new TopicExchange("t"); String routingKey = "r"; Binding binding = BindingBuilder.bind(queue).to(topicExchange).with(routingKey); assertNotNull(binding); assertEquals(topicExchange.getName(), binding.getExchange()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertEquals(routingKey, binding.getRoutingKey()); }
@Test public void directBinding() { DirectExchange directExchange = new DirectExchange("d"); String routingKey = "r"; Binding binding = BindingBuilder.bind(queue).to(directExchange).with(routingKey); assertNotNull(binding); assertEquals(directExchange.getName(), binding.getExchange()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertEquals(routingKey, binding.getRoutingKey()); }
@Test public void directBindingWithQueueName() { DirectExchange directExchange = new DirectExchange("d"); Binding binding = BindingBuilder.bind(queue).to(directExchange).withQueueName(); assertNotNull(binding); assertEquals(directExchange.getName(), binding.getExchange()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertEquals(queue.getName(), binding.getRoutingKey()); }