com.dell.cpsd.hal.data.provider.client.config.HalDataProviderRabbitConfig Maven / Gradle / Ivy
/**
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*/
package com.dell.cpsd.hal.data.provider.client.config;
import com.dell.cpsd.common.logging.ILogger;
import com.dell.cpsd.hal.data.provider.client.log.HDPCLoggingManager;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import com.dell.cpsd.common.rabbitmq.utils.ContainerIdHelper;
/**
* This is the configuration for the shared Rabbit MQ artifacts used by a client.
*
*
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*
*
* @since 1.0
*/
@Configuration
public class HalDataProviderRabbitConfig
{
// TODO pass the response exchange in the message and publish using it.
/*
* The logger for this class.
*/
private static final ILogger LOGGER = HDPCLoggingManager.getLogger(HalDataProviderRabbitConfig.class);
/*
* The name of the service exchange.
*/
private static final String EXCHANGE_HDP_WORK_RESPONSE = "exchange.dell.cpsd.hdp.hal.data.provider.work.response";
/*
* The RabbitMQ connection factory.
*/
@Autowired
@Qualifier("rabbitConnectionFactory")
private ConnectionFactory rabbitConnectionFactory;
/*
* The environment properties.
*/
@Autowired
private Environment environment;
/**
* This returns the host name for the client.
*
* @return The host name for the client.
*
* @since 1.0
*/
@Bean
String hostName()
{
return ContainerIdHelper.getContainerId();
}
/**
* This returns the TopicExchange
for the service request messages.
*
* @return The TopicExchange
for message from the service.
*
* @since 1.0
*/
@Bean(name = "halDataProviderWorkResponseExchange")
public TopicExchange halDataProviderWorkResponseExchange()
{
return new TopicExchange(EXCHANGE_HDP_WORK_RESPONSE);
}
/**
* This returns the AmqpAdmin
for the connection factory.
*
* @return The AMQP admin object for the connection factory.
*
* @since 1.0
*/
@Bean
AmqpAdmin halDataProviderAmqpAdmin()
{
return new RabbitAdmin(rabbitConnectionFactory);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy