當前位置: 首頁>>代碼示例>>Java>>正文


Java CachingConnectionFactory.setUsername方法代碼示例

本文整理匯總了Java中org.springframework.amqp.rabbit.connection.CachingConnectionFactory.setUsername方法的典型用法代碼示例。如果您正苦於以下問題:Java CachingConnectionFactory.setUsername方法的具體用法?Java CachingConnectionFactory.setUsername怎麽用?Java CachingConnectionFactory.setUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.amqp.rabbit.connection.CachingConnectionFactory的用法示例。


在下文中一共展示了CachingConnectionFactory.setUsername方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAmqpConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
ConnectionFactory getAmqpConnectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port);
    LOGGER.info("Creating AMQP connection factory on host {}:{}", host, port);
    if (!username.isEmpty()) {
        connectionFactory.setUsername(username);
        LOGGER.info("Logging to AMQP with username ", username);
    } else {
        LOGGER.warn("Logging to AMQP with NO username");
    }
    if (!password.isEmpty()) {
        connectionFactory.setPassword(password);
        LOGGER.info("Logging to AMQP with password {}", password.replaceAll(".", "*"));
    } else {
        LOGGER.warn("Logging to AMQP with NO password");
    }
    return connectionFactory;
}
 
開發者ID:Byteflair,項目名稱:resthooks,代碼行數:19,代碼來源:AmqpConfig.java

示例2: rabbitConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
ConnectionFactory rabbitConnectionFactory(final RabbitMqSetupService rabbitmqSetupService) {
    final CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setHost(rabbitmqSetupService.getHostname());
    factory.setPort(5672);
    factory.setUsername(rabbitmqSetupService.getUsername());
    factory.setPassword(rabbitmqSetupService.getPassword());
    try {
        factory.setVirtualHost(rabbitmqSetupService.createVirtualHost());
        // All exception are catched. The BrokerRunning decide if the
        // test should break or not
    } catch (@SuppressWarnings("squid:S2221") final Exception e) {
        Throwables.propagateIfInstanceOf(e, AlivenessException.class);
        LOG.error("Cannot create virtual host {}", e.getMessage());
    }
    return factory;
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:18,代碼來源:AmqpTestConfiguration.java

示例3: rabbitConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory rabbitConnectionFactory() {
	com.rabbitmq.client.ConnectionFactory cf = new com.rabbitmq.client.ConnectionFactory();
	cf.setNetworkRecoveryInterval(rabbitNetworkRecoveryInterval);
	cf.setRequestedHeartbeat(rabbitHeartbeatInterval);
	
	CachingConnectionFactory connectionFactory = new CachingConnectionFactory(cf);
	connectionFactory.setVirtualHost(rabbitVirtualHost);
	connectionFactory.setAddresses(rabbitAddresses);
	connectionFactory.setUsername(rabbitUsername);
    connectionFactory.setPassword(rabbitPassword);
    connectionFactory.setPublisherConfirms(publisherConfirms);
    connectionFactory.setConnectionTimeout(rabbitConnectionTimeout);
    connectionFactory.setChannelCheckoutTimeout(rabbitChannelCheckoutTimeout);
    connectionFactory.setCloseTimeout(rabbitCloseTimeout);
    return connectionFactory;
}
 
開發者ID:sshcherbakov,項目名稱:cf-service-tester,代碼行數:18,代碼來源:StandaloneConfig.java

示例4: rabbitConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory rabbitConnectionFactory(
        @Value("${rabbitMq.connection.host}") String host,
        @Value("${rabbitMq.connection.port}") Integer port,
        @Value("${rabbitMq.connection.username:}") String username,
        @Value("${rabbitMq.connection.password:}") String password
) {
    CachingConnectionFactory connectionFactory =
        new CachingConnectionFactory(host, port);
    connectionFactory.setUsername(username);
    connectionFactory.setPassword(password);
    connectionFactory.setChannelCacheSize(1);
    List<ChannelListener> listeners = new LinkedList<>();
    listeners.add(
            (channel, transactional) -> log.info("Channel created; Number:  " + channel.getChannelNumber())
    );
    connectionFactory.setChannelListeners(listeners);
    this.connectionFactory = connectionFactory;
    return connectionFactory;
}
 
開發者ID:datenstrudel,項目名稱:bulbs-core,代碼行數:21,代碼來源:NotificationConfig.java

示例5: connectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory connectionFactory() {
    final URI ampqUrl;
    try {
        ampqUrl = new URI(getEnvOrThrow("CLOUDAMQP_URL"));
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }

    final CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setUsername(ampqUrl.getUserInfo().split(":")[0]);
    factory.setPassword(ampqUrl.getUserInfo().split(":")[1]);
    factory.setHost(ampqUrl.getHost());
    factory.setPort(ampqUrl.getPort());
    factory.setVirtualHost(ampqUrl.getPath().substring(1));
    factory.setPublisherReturns(true);

    return factory;
}
 
開發者ID:ShoppinPal,項目名稱:cloud-pos-router,代碼行數:20,代碼來源:RabbitConfiguration.java

示例6: connectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
ConnectionFactory connectionFactory() {
    CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setUsername(username);
    factory.setPassword(password);
    factory.setAddresses(addresses);
    return factory;
}
 
開發者ID:Rustam-Kadyrov,項目名稱:microservices-spring,代碼行數:9,代碼來源:RabbitMqConfiguration.java

示例7: getConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean(name = "connectionFactory")
public ConnectionFactory getConnectionFactory() {
    CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setHost(rabbitMQProperties.getHost());
    factory.setUsername(rabbitMQProperties.getUsername());
    factory.setPassword(rabbitMQProperties.getPassword());
    factory.setVirtualHost(rabbitMQProperties.getVhost());
    factory.setPublisherConfirms(true);
    factory.setPublisherReturns(true);
    return factory;
}
 
開發者ID:Evan1120,項目名稱:springboot-sample,代碼行數:12,代碼來源:RabbitmqConfiguration.java

示例8: rabbitMQConnection

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public CachingConnectionFactory rabbitMQConnection(){
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
    connectionFactory.setHost("127.0.0.1");
    connectionFactory.setPort(5672);
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    return connectionFactory;
}
 
開發者ID:MarcinStachowiak,項目名稱:spring-integration-dsl-samle,代碼行數:10,代碼來源:AbstractNotificationFlowConfiguration.java

示例9: commandBusConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory commandBusConnectionFactory() {

    log.info("Creating command bus connection on hostname: {" + this.hostname + "}");

    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory(this.hostname, this.port);
    connectionFactory.setUsername(this.username);
    connectionFactory.setPassword(this.password);

    return connectionFactory;
}
 
開發者ID:sem2nawara,項目名稱:acme-solution,代碼行數:12,代碼來源:CommandBusConfigurer.java

示例10: eventBusConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory eventBusConnectionFactory() {

    log.info("Creating query event bus connection on hostname: {" + this.hostname + "}");

    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory(this.hostname, this.port);
    connectionFactory.setUsername(this.username);
    connectionFactory.setPassword(this.password);

    return connectionFactory;
}
 
開發者ID:sem2nawara,項目名稱:acme-solution,代碼行數:12,代碼來源:EventBusConfigurer.java

示例11: getConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory getConnectionFactory() {

    log.info("Creating rabbit connection for command bus, publishing, on host: {" + this.hostname + "}");

    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory(this.hostname, this.port);
    connectionFactory.setUsername(this.username);
    connectionFactory.setPassword(this.password);

    return connectionFactory;
}
 
開發者ID:sem2nawara,項目名稱:acme-solution,代碼行數:12,代碼來源:RabbitConfigurer.java

示例12: eventBusConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
@Primary
public ConnectionFactory eventBusConnectionFactory() {

    log.info("Creating event bus connection on hostname: {" + this.hostname + "}");

    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory(this.hostname, this.port);
    connectionFactory.setUsername(this.username);
    connectionFactory.setPassword(this.password);

    return connectionFactory;
}
 
開發者ID:sem2nawara,項目名稱:acme-solution,代碼行數:13,代碼來源:EventBusConfigurer.java

示例13: outConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory outConnectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(userName);
    connectionFactory.setPassword(userPassword);
    connectionFactory.setVirtualHost(virtualHost);

    return connectionFactory;
}
 
開發者ID:dvoraka,項目名稱:av-service,代碼行數:10,代碼來源:AmqpBridgeOutputConfig.java

示例14: serverConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public ConnectionFactory serverConnectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(userName);
    connectionFactory.setPassword(userPassword);
    connectionFactory.setVirtualHost(virtualHost);

    return connectionFactory;
}
 
開發者ID:dvoraka,項目名稱:av-service,代碼行數:10,代碼來源:AmqpCommonServerConfig.java

示例15: connectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public CachingConnectionFactory connectionFactory() {
    CachingConnectionFactory bean = new CachingConnectionFactory(env.getProperty("rabbitmq.hostname"), Integer.parseInt(env.getProperty("rabbitmq.port")));
    bean.setUsername(env.getProperty("rabbitmq.username"));
    bean.setPassword(env.getProperty("rabbitmq.password"));
    return bean;
}
 
開發者ID:dovier,項目名稱:coj-web,代碼行數:8,代碼來源:AMQPConfiguration.java


注:本文中的org.springframework.amqp.rabbit.connection.CachingConnectionFactory.setUsername方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。