Examples of CachingConnectionFactory


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

        if(this.amqpAdministration == null && getCamelContext() != null && getCamelContext().getRegistry() != null) {
            //Attempt to load an administration connection from the registry
            this.amqpAdministration = new HashMap<String, AmqpAdmin>();
            Map<String, AmqpAdmin> adminMap = getCamelContext().getRegistry().findByTypeWithName(AmqpAdmin.class);
            for(AmqpAdmin admin : adminMap.values()){
                CachingConnectionFactory adminConnection = (CachingConnectionFactory)((RabbitAdmin)admin).getRabbitTemplate().getConnectionFactory();
                for(Map.Entry<String, ConnectionFactory> connection : this.connectionFactory.entrySet()){
                    if(adminConnection.getHost().equals(connection.getValue().getHost()) && adminConnection.getPort() == (connection.getValue().getPort())){
                        this.amqpAdministration.put(connection.getKey(), admin);
                        break;
                    }
                }
            }
View Full Code Here

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

        if(this.amqpTemplate == null && getCamelContext() != null && getCamelContext().getRegistry() != null) {
            //Attempt to load an AMQP template from the registry
            this.amqpTemplate = new HashMap<String, AmqpTemplate>();
            Map<String, AmqpTemplate> templateMap = getCamelContext().getRegistry().findByTypeWithName(AmqpTemplate.class);
            for(AmqpTemplate template : templateMap.values()){
                CachingConnectionFactory adminConnection = (CachingConnectionFactory)((RabbitTemplate) template).getConnectionFactory();
                for(Map.Entry<String, ConnectionFactory> connection : this.connectionFactory.entrySet()){
                    if(adminConnection.getHost().equals(connection.getValue().getHost()) && adminConnection.getPort() == (connection.getValue().getPort())){
                        this.amqpTemplate.put(connection.getKey(), template);
                        break;
                    }
                }
            }
View Full Code Here

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

    return null;
  }
 
  @Bean
  public ConnectionFactory rabbitConnectionFactory() {
    return new CachingConnectionFactory();
  }
View Full Code Here

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

        .getProperty(NUM_RETRIES_PROPERTY, 5);
  }

  public void connect() {

    cf = new CachingConnectionFactory(address.getHost(), address.getPort());
    admin = new RabbitAdmin(cf);

    declarePipelineCreationQueue(admin);
  }
View Full Code Here

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

        mockEndpoint.assertIsSatisfied();
    }
   
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CachingConnectionFactory factory = new CachingConnectionFactory();
        RabbitTemplate amqpTemplate = new RabbitTemplate(factory);
        SpringAMQPComponent amqpComponent = new SpringAMQPComponent(factory);
        amqpComponent.setAmqpTemplate(amqpTemplate);
       
        CamelContext camelContext = super.createCamelContext();
View Full Code Here

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

      Assert.assertNotNull(endpoint.toString());
    }   
       
    @Override
    protected CamelContext createCamelContext() throws Exception {
        ConnectionFactory factory = new CachingConnectionFactory();
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", new SpringAMQPComponent(factory));
        return camelContext;
    }
View Full Code Here

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

        Assert.assertEquals(child, SpringAMQPComponent.findRootCause(grandparent));
    }
   
    @Override
    protected CamelContext createCamelContext() throws Exception {
        ConnectionFactory factory = new CachingConnectionFactory();
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", new SpringAMQPComponent(factory));
        return camelContext;
    }
View Full Code Here

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

        return registry;
    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CachingConnectionFactory factory = new CachingConnectionFactory();
        RabbitTemplate amqpTemplate = new RabbitTemplate(factory);
        //The JSON converter stresses marshalling more than the default converter
        amqpTemplate.setMessageConverter(new JsonMessageConverter());
        SpringAMQPComponent amqpComponent = new SpringAMQPComponent(factory);
        amqpComponent.setAmqpTemplate(amqpTemplate);
View Full Code Here

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

  @Bean
  // TODO: Move to spring boot
  public ConnectionFactory rabbitConnectionFactory(RabbitProperties config,
      com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory) throws Exception {
    CachingConnectionFactory factory = new CachingConnectionFactory(rabbitConnectionFactory);
    factory.setAddresses(config.getAddresses());
    if (config.getHost() != null) {
      factory.setHost(config.getHost());
      factory.setPort(config.getPort());
    }
    if (config.getUsername() != null) {
      factory.setUsername(config.getUsername());
    }
    if (config.getPassword() != null) {
      factory.setPassword(config.getPassword());
    }
    if (config.getVirtualHost() != null) {
      factory.setVirtualHost(config.getVirtualHost());
    }
    return factory;
  }
View Full Code Here

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

    super("RABBIT");
  }

  @Override
  protected void obtainResource() throws Exception {
    resource = new CachingConnectionFactory("localhost");
    resource.createConnection().close();
  }
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.