Search in sources :

Example 1 with HealthCheckInfoData

use of org.openkilda.messaging.info.discovery.HealthCheckInfoData in project open-kilda by telstra.

the class KafkaHealthCheckMessageConsumer method receive.

/**
 * Receives messages from WorkFlowManager queue.
 *
 * @param record the message object instance
 */
@KafkaListener(id = "northbound-listener-health-check", topics = Topic.HEALTH_CHECK)
public void receive(final String record) {
    try {
        logger.trace("message received");
        Message message = MAPPER.readValue(record, Message.class);
        if (Destination.NORTHBOUND.equals(message.getDestination())) {
            logger.debug("message received: {}", record);
            InfoMessage info = (InfoMessage) message;
            HealthCheckInfoData healthCheck = (HealthCheckInfoData) info.getData();
            messages.put(healthCheck.getId(), healthCheck);
        } else {
            logger.trace("Skip message: {}", message);
        }
    } catch (IOException exception) {
        logger.error("Could not deserialize message: {}", record, exception);
    }
}
Also used : HealthCheckInfoData(org.openkilda.messaging.info.discovery.HealthCheckInfoData) InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) InfoMessage(org.openkilda.messaging.info.InfoMessage) IOException(java.io.IOException) KafkaListener(org.springframework.kafka.annotation.KafkaListener)

Aggregations

IOException (java.io.IOException)1 Message (org.openkilda.messaging.Message)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 HealthCheckInfoData (org.openkilda.messaging.info.discovery.HealthCheckInfoData)1 KafkaListener (org.springframework.kafka.annotation.KafkaListener)1