package de.hottis.MeasurementCollector;

import java.util.Properties;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class MeasurementCollector {
	static final String PROPS_FILENAME = "measurementCollector.props";
	static final Logger logger = LogManager.getRootLogger();
	
	
	public static void main(String[] args) throws Exception {
		logger.info("MeasurementCollector starting");
		
		final Properties config = new Properties();
		config.load(MeasurementCollector.class.getClassLoader().getResourceAsStream(PROPS_FILENAME));
		
		
		MqttReceiver mqttReceiver = new MqttReceiver(config);
		mqttReceiver.connect();

		DataObjectQueue queue = new DataObjectQueue();
		
		MBusParser mbusParser = new MBusParser(config, queue);
		mbusParser.registerConfiguredDataParsers();
		mqttReceiver.registerParser(mbusParser);
		
	}
		
}
