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

com.dell.cpsd.common.rabbitmq.context.builder.MessageMetaDataReader Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/**
 * Copyright © 2017 Dell Inc. or its subsidiaries.  All Rights Reserved.
 * Dell EMC Confidential/Proprietary Information
 */

package com.dell.cpsd.common.rabbitmq.context.builder;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;

/**
 * 

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

* @author Connor Goulding */ public class MessageMetaDataReader { private static final Logger LOGGER = LoggerFactory.getLogger(MessageMetaDataReader.class); private final ObjectMapper mapper = new ObjectMapper(); public List read(File file) { try (FileInputStream fis = new FileInputStream(file)) { MessagingData messagingData = mapper.readValue(fis, MessagingData.class); return messagingData.getMessages(); } catch (IOException e) { LOGGER.error("Unable to read meta data file: " + file, e); } return Collections.emptyList(); } public List read(InputStream is) throws IOException { MessagingData messagingData = mapper.readValue(is, MessagingData.class); return messagingData.getMessages(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy