Examples of CachingConnectionFactory


Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

  protected final String payProcQueueName = "PAYMENT_QUEUE";

  @Bean
  public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    return connectionFactory;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    logger.info("RabbitMQ:");
    createService(VCAP_RABBIT_SERVICE, "rabbitmq", "2.4");
    int tunnelPort = LOCAL_PORT + 4;
    createTunnelServer(VCAP_RABBIT_SERVICE, tunnelPort);

    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(LOCAL_HOST, tunnelPort);
    connectionFactory.setUsername(svc_username);
    connectionFactory.setPassword(svc_passwd);
    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();

    template.convertAndSend("Hello, CloudFoundry!");
    template.convertAndSend("Hello, Spring!");
    template.convertAndSend("Hello, Java!");
    template.convertAndSend("Hello, Caldecott!");
    template.convertAndSend("Hello, Rabbit!");
    template.convertAndSend("Hello, AMQP!");

    int count = 0;
    while (true) {
      String message = (String) template.receiveAndConvert();
      if (message == null) {
        break;
      }
      else {
        count++;
      }
    }

    Assert.assertEquals("Did not send/receive the messages correctly", 6, count);

    connectionFactory.destroy();

    stopTunnelServer();
    removeService(VCAP_RABBIT_SERVICE);
    logger.info("Time elapsed: " + (System.currentTimeMillis() - start) / 1000.0d + " sec");
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

  protected final String helloWorldQueueName = "hello.world.queue";

  @Bean
  public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    return connectionFactory;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    return template;
  }

  @Bean
  public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    return connectionFactory;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

  protected abstract void configureRabbitTemplate(RabbitTemplate template);

  @Bean
  public ConnectionFactory connectionFactory() {
    //TODO make it possible to customize in subclasses.
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    connectionFactory.setPort(port);
    return connectionFactory;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

  @Value("${amqp.host:localhost}")
  private String host = "localhost";

  @Bean
  public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(username);
    connectionFactory.setPassword(password);
    connectionFactory.setVirtualHost(virtualHost);
    connectionFactory.setPort(port);
    return connectionFactory;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    protected AmqpTemplate amqpTemplate;
    protected AmqpAdmin amqpAdministration;
    public static final String ROUTING_KEY_HEADER = "ROUTING_KEY";
   
    public SpringAMQPComponent() {
        this.connectionFactory = new CachingConnectionFactory();
    }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    protected AmqpTemplate amqpTemplate;
    protected AmqpAdmin amqpAdministration;
    public static final String ROUTING_KEY_HEADER = "ROUTING_KEY";
   
    public SpringAMQPComponent() {
        this.connectionFactory = new CachingConnectionFactory();
    }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    protected AmqpTemplate amqpTemplate;
    protected AmqpAdmin amqpAdministration;
    public static final String ROUTING_KEY_HEADER = "ROUTING_KEY";
   
    public SpringAMQPComponent() {
        this.connectionFactory = new CachingConnectionFactory();
    }
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.CachingConnectionFactory

    public static final String ROUTING_KEY_HEADER = "ROUTING_KEY";
    public static final String DEFAULT_CONNECTION = "DefaultConnection";
    public static final String CONNECTION_HEADER = "CONNECTION=";

    public SpringAMQPComponent() {
        this(new CachingConnectionFactory());
    }
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.