package de.hottis.measurementCollector;

import java.util.Properties;

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


public class MeasurementDatabaseEngine {
	static final String PROPS_FILENAME = "measurementDataEngine.props";
	static final Logger logger = LogManager.getRootLogger();
	
	
	public static void main(String[] args) throws Exception {
		logger.info("MeasurementDatabaseEngine starting");
		
		final Properties config = new Properties();
		config.load(MeasurementDatabaseEngine.class.getClassLoader().getResourceAsStream(PROPS_FILENAME));
		logger.debug("Configuration loaded");
		
		JmsTopic<ADataObject> queue = new JmsTopic<ADataObject>(config, JmsTopic.Mode.CONSUMER); 
		queue.init();
		
		DatabaseEngine databaseEngine = new DatabaseEngine(config, queue);
		databaseEngine.init();
		databaseEngine.start();
		logger.debug("DatabaseEngine started");
	}
		
}
