com.dell.cpsd.common.rabbitmq.config.RabbitMQPropertiesConfig Maven / Gradle / Ivy
The newest version!
/**
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*/
package com.dell.cpsd.common.rabbitmq.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
/**
* Configuration for common RabbitMQ properties.
*
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*
*
* @since SINCE-TBD
*/
@Configuration
public class RabbitMQPropertiesConfig implements IRabbitMqPropertiesConfig
{
/**
* The Environment.
*/
@Autowired
protected Environment environment;
/**
* RabbitMQPropertiesConfig constructor.
*
* @since SINCE-TBD
*/
public RabbitMQPropertiesConfig()
{
super();
}
/**
* This returns the rabbit host name. The name of the property is
* remote.dell.amqp.rabbitHostname
.
*
* @return The rabbit host name.
* @since SINCE-TBD
*/
@Bean
public String rabbitHostname()
{
return environment.getRequiredProperty("remote.dell.amqp.rabbitHostname");
}
/**
* This returns the secondary host names. The name of the property is
* remote.dell.secondaries.amqp.rabbitHostname
.
*
* @return The secondary rabbit host names.
* @since SINCE-TBD
*/
@Bean
public String secondaryHostnames()
{
return environment.getProperty("remote.dell.secondaries.amqp.rabbitHostname", "");
}
/**
* This returns the rabbit amqp port number. The name of the property is
* remote.dell.amqp.rabbitPort
.
*
* @return The rabbit port number.
* @since SINCE-TBD
*/
@Bean
public Integer rabbitPort()
{
return environment.getProperty("remote.dell.amqp.rabbitPort", Integer.class, 5672);
}
/**
* This returns the rabbit broker password. The name of the property is
* remote.dell.amqp.rabbitPassword
.
*
* @return The rabbit broker password.
* @since SINCE-TBD
*/
@Bean
public String rabbitPassword()
{
return environment.getProperty("remote.dell.amqp.rabbitPassword", "");
}
/**
* This returns the rabbit user name. The name of the property is
* remote.dell.amqp.rabbitUsername
.
*
* @return The rabbit user name.
* @since SINCE-TBD
*/
@Bean
public String rabbitUsername()
{
return environment.getProperty("remote.dell.amqp.rabbitUsername", "");
}
/**
* This returns the rabbit virtual host name. The name of the property is
* remote.dell.amqp.rabbitVirtualHost
.
*
* @return The rabbit virtual hostname.
* @since SINCE-TBD
*/
@Bean
public String rabbitVirtualHost()
{
return environment.getRequiredProperty("remote.dell.amqp.rabbitVirtualHost");
}
/**
* This returns the rabbit heartbeat interval. The name of the property is
* remote.dell.amqp.rabbitRequestedHeartbeat
.
*
* @return The rabbit heartbeat interval.
* @since SINCE-TBD
*/
@Bean
public Integer rabbitRequestedHeartbeat()
{
return environment.getProperty("remote.dell.amqp.rabbitRequestedHeartbeat", Integer.class, 0);
}
/**
* This returns the name of the data center. The name of the property is
* data.center
.
*
* @return The name of the data center.
* @since SINCE-TBD
*/
@Bean
public String dataCenter()
{
return environment.getRequiredProperty("data.center");
}
@Bean
public String applicationName()
{
return environment.getProperty("application.name", "");
}
@Deprecated
@Bean
public String trustStorePassphrase()
{
return environment.getProperty("remote.dell.amqp.rabbitTrustStorePassphrase", "");
}
@Deprecated
@Bean
public String keyStorePassPhrase()
{
return environment.getProperty("remote.dell.amqp.rabbitKeyStorePassPhrase", "");
}
@Deprecated
@Bean
public String keyStorePath()
{
return environment.getProperty("remote.dell.amqp.rabbitKeyStorePath", "");
}
@Deprecated
@Bean
public String trustStorePath()
{
return environment.getProperty("remote.dell.amqp.rabbitTrustStorePath", "");
}
@Bean
public String tlsVersion()
{
return environment.getProperty("remote.dell.amqp.rabbitTlsVersion", "TLSv1.2");
}
@Bean
public Boolean isSslEnabled()
{
return Boolean.valueOf(environment.getProperty("remote.dell.amqp.rabbitIsSslEnabled", Boolean.TRUE.toString()));
}
}