All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dell.cpsd.rcm.evaluation.client.amqp.consumer.AmqpRcmEvaluationConsumer Maven / Gradle / Ivy

Go to download

This repository contains the source code for the rcm evaluation service API. Use this repository to share contracts between services so you can create POJOs using defined JSON schemas and to create message transformers for the RCM evaluation service.

The newest version!
/**
 * Copyright © 2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
 * Dell EMC Confidential/Proprietary Information
 */

package com.dell.cpsd.rcm.evaluation.client.amqp.consumer;

import com.dell.cpsd.common.rabbitmq.consumer.UnhandledMessageConsumer;

import com.dell.cpsd.common.logging.ILogger;

import com.dell.cpsd.rcm.evaluation.client.log.RFESLoggingManager;
import com.dell.cpsd.rcm.evaluation.client.log.RFESMessageCode;

import com.dell.cpsd.rcm.evaluation.service.api.SystemRcmEvaluationMessage;
import com.dell.cpsd.rcm.evaluation.service.api.RcmEvaluationErrorMessage;

/**
 * This is the message consumer that handles responses from the service.
 * 
 * 

* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved. * Dell EMC Confidential/Proprietary Information *

* * @version 1.0 * * @since SINCE-TBD */ public class AmqpRcmEvaluationConsumer extends UnhandledMessageConsumer implements IAmqpRcmEvaluationConsumer { /* * The logger for this class. */ private static final ILogger LOGGER = RFESLoggingManager.getLogger(AmqpRcmEvaluationConsumer.class); /* * The IAmqpRcmEvaluationMessageHandler that handles messages. */ private IAmqpRcmEvaluationMessageHandler handler = null; /* * The routing key for the message queue for this consumer. */ private String routingKey = null; /** * AmqpRcmEvaluationConsumer constructor * * @since SINCE-TBD */ public AmqpRcmEvaluationConsumer(final String routingKey) { super(); if (routingKey == null) { throw new IllegalArgumentException("The routing key is not set."); } this.routingKey = routingKey; } /** * {@inheritDoc} */ @Override public String getRoutingKey() { return this.routingKey; } /** * {@inheritDoc} */ @Override public IAmqpRcmEvaluationMessageHandler getRcmEvaluationMessageHandler() { return this.handler; } /** * {@inheritDoc} */ @Override public void setRcmEvaluationMessageHandler( IAmqpRcmEvaluationMessageHandler handler) { if (handler == null) { throw new IllegalArgumentException("The message handler is null."); } this.handler = handler; } /** * This handles the SystemRcmEvaluationMessage that is * consumed from the service queue. * * @param message The result of the system RCM evaluation. * * @since SINCE-TBD */ public void handleMessage(final SystemRcmEvaluationMessage message) { if (message == null) { LOGGER.warn(RFESMessageCode.SYSTEM_RCM_EVALUATION_NULL_W.getMessageCode()); return; } if (this.handler == null) { LOGGER.warn(RFESMessageCode.SERVICE_HANDLER_NULL_W.getMessageCode()); return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug(" handleMessage : " + message); } this.handler.handleSystemRcmEvaluation(message); } /** * This handles the RcmEvaluationErrorMessage that is consumed * from the service queue. * * @param message The RcmEvaluationErrorMessage to consume. * * @since SINCE-TBD */ public void handleMessage(final RcmEvaluationErrorMessage message) { if (message == null) { LOGGER.warn(RFESMessageCode.SERVICE_ERROR_NULL_W.getMessageCode()); return; } if (this.handler == null) { LOGGER.warn(RFESMessageCode.SERVICE_HANDLER_NULL_W.getMessageCode()); return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug(" handleMessage : " + message); } this.handler.handleEvaluationServiceError(message); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy