Package org.springframework.amqp.rabbit.core

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()


    connectionFactory.setVirtualHost(svc_vhost);

    String queueName = "CLOUD";
    AmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);
    Queue cloudQueue = new Queue(queueName);
    amqpAdmin.declareQueue(cloudQueue);

    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    template.setRoutingKey(queueName);
    template.setQueue(queueName);
    template.afterPropertiesSet();
View Full Code Here


    // pre-declare the queue with dead-lettering, users can also use a policy
    RabbitAdmin admin = new RabbitAdmin(this.rabbitAvailableRule.getResource());
    Map<String, Object> args = new HashMap<String, Object>();
    args.put("x-dead-letter-exchange", "xdbustest.DLX");
    Queue queue = new Queue("xdbustest.dlqtest", true, false, false, args);
    admin.declareQueue(queue);

    MessageBus bus = getMessageBus();
    Properties properties = new Properties();
    properties.put("prefix", "xdbustest.");
    properties.put("autoBindDLQ", "true");
View Full Code Here

   * Creates an instance of the queue on the rabbit broker. If already present then no action is taken.
   */
  public void createQueue() {
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    Queue sourceQueue = new Queue(queue, false, false, true);
    admin.declareQueue(sourceQueue);
    TopicExchange exchange = new TopicExchange(DEFAULT_EXCHANGE);
    admin.declareExchange(exchange);
    admin.declareBinding(
        BindingBuilder.bind(sourceQueue).to(exchange).with("rabbitfixture.*"));
  }
 
View Full Code Here

    RabbitAdmin admin = new RabbitAdmin(template.getConnectionFactory());
    Map<String, Object> args = new HashMap<String, Object>();
    args.put("x-dead-letter-exchange", "test.DLE");
    Queue queue = new Queue("", false, false, true, args);
    String testQueueName = admin.declareQueue(queue);
    // Create a DeadLetterExchange and bind a queue to it with the original routing key
    DirectExchange dle = new DirectExchange("test.DLE", false, true);
    admin.declareExchange(dle);
    Queue dlq = new AnonymousQueue();
    admin.declareQueue(dlq);
View Full Code Here

    String testQueueName = admin.declareQueue(queue);
    // Create a DeadLetterExchange and bind a queue to it with the original routing key
    DirectExchange dle = new DirectExchange("test.DLE", false, true);
    admin.declareExchange(dle);
    Queue dlq = new AnonymousQueue();
    admin.declareQueue(dlq);
    admin.declareBinding(BindingBuilder.bind(dlq).to(dle).with(testQueueName));

    container.setQueueNames(testQueueName);
    container.afterPropertiesSet();
    container.start();
View Full Code Here

        if (isDefaultQueue(queueName)) {
          // Just for test probe.
          admin.deleteQueue(queueName);
        }
        else {
          admin.declareQueue(queue);
        }
      }
      brokerOffline.put(port, false);
      if (!assumeOnline) {
        Assume.assumeTrue(brokerOffline.get(port));
View Full Code Here

  public SimpleMessageListenerContainer listenerContainer() {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory());
    Queue q = testQueue();

    RabbitAdmin admin = rabbitAdmin();
    admin.declareQueue(q);
    admin.declareBinding(testBinding());

    container.setQueues(q);
    // container.setMessageListener(testListener(4));
    container.setAutoStartup(false);
View Full Code Here

    container.afterPropertiesSet();

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    for (int i = 0; i < 20; i++) {
      AnonymousQueue anonymousQueue = new AnonymousQueue();
      admin.declareQueue(anonymousQueue);
      container.addQueueNames(anonymousQueue.getName());
      if (!container.isRunning()) {
        container.start();
      }
    }
View Full Code Here

      throws InterruptedException {
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    // queue doesn't exist during startup - verify we started, create queue and verify recovery
    Thread.sleep(5000);
    assertEquals(messageCount, latch.getCount());
    admin.declareQueue(new Queue("nonexistent"));
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend("nonexistent", "foo" + i);
    }
    assertTrue(latch.await(10, TimeUnit.SECONDS));
View Full Code Here

    admin.deleteQueue("nonexistent");
    Thread.sleep(3000);
    latch = new CountDownLatch(messageCount);
    container.setMessageListener(new MessageListenerAdapter(new VanillaListener(latch)));
    assertEquals(messageCount, latch.getCount());
    admin.declareQueue(new Queue("nonexistent"));
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend("nonexistent", "foo" + i);
    }
    assertTrue(latch.await(10, TimeUnit.SECONDS));
    assertEquals(1, consumers.size());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.