// Path: distribution/src/main/java/nl/crowndov/displaydirect/distribution/util/CatchableRunnable.java
// public class CatchableRunnable implements Runnable {
//     private final Runnable runnable;
//     private final Logger logger;
// 
//     public CatchableRunnable(Runnable runnable, Class c) {
//         this.runnable = runnable;
//         // Allow to customize the class used to log any error messages
//         this.logger = LoggerFactory.getLogger(c);
//     }
// 
//     public CatchableRunnable(Runnable runnable) {
//         this(runnable, CatchableRunnable.class);
//     }
// 
//     @Override
//     public void run() {
//         try {
//             runnable.run();
//         } catch (Exception e) {
//             if (logger != null) {
//                 logger.error("Failed to run task {}, got exception", runnable.toString(), e);
//             }
//         }
//     }
// }
// 
// Path: distribution/src/main/java/nl/crowndov/displaydirect/distribution/Configuration.java
// public class Configuration {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(Configuration.class);
// 
//     private static AbstractConfiguration config = ConfigurationManager.getConfigInstance();
// 
//     public static List<String> getKvEndpoints() {
//         return Arrays.asList(config.getStringArray("distribution.kv78turbo.endpoints"));
//     }
// 
//     public static String[] getKvPublishers() {
//         return config.getStringArray("distribution.kv78turbo.publishers");
//     }
// 
//     public static ZoneId getZoneId() {
//         return ZoneId.of(config.getString("distribution.timezone.default"));
//     }
// 
//     public static String getOutputTransport() {
//         return config.getString("distribution.transport", "mqtt");
//     }
// 
//     public static String getMqttBrokerHost() {
//         return config.getString("distribution.mqtt.host", "localhost:1883");
//     }
// 
//     public static int getZmqInternalPort() {
//         return 9800;
//     }
// 
//     public static String getMqttClientId() {
//         return config.getString("distribution.mqtt.client_id", "distribution");
//     }
// 
//     public static int getAuthorizationTokenMaxAge() {
//         return config.getInt("distribution.authorization.max_age_hours");
//     }
// 
//     public static List<String> getAuthorizationWhitelist() {
//         return Arrays.asList(config.getStringArray("distribution.authorization.whitelist_prefix"));
//     }
// 
//     public static String getBaseUrl() {
//         return config.getString("distribution.install.base_url", "http://localhost:8080");
//     }
// 
//     public static String getSmtpUsername() {
//         return config.getString("distribution.smtp.username", null);
//     }
// 
//     public static String getSmtpPassword() {
//         return config.getString("distribution.smtp.password", null);
//     }
// 
//     public static String getSmtpFrom() {
//         return config.getString("distribution.smtp.from");
//     }
// 
//     public static String getSmtpHostname() {
//         return config.getString("distribution.smtp.hostname");
//     }
// 
//     public static String getSmtpReplyTo() {
//         return config.getString("distribution.smtp.reply_to");
//     }
// 
//     public static boolean getSmtpSsl() { return config.getBoolean("distribution.smtp.ssl", false); }
// 
//     public static int getSmtpPort() {
//         return config.getInt("distribution.smtp.port", 25);
//     }
// 
//     public static int getSmtpConnectTimeout() {
//         return  config.getInt("distribution.smtp.connect_timeout", 10*1000);
//     }
// 
//     public static String getFileBasePath() {
//         return config.getString("distribution.backup.path", System.getProperty("java.io.tmpdir"));
//     }
// 
//     public static String getKv7PlanningPath() {
//         return config.getString("distribution.kv78turbo.path.planning");
//     }
// 
//     public static String getKv7CalendarPath() {
//         return config.getString("distribution.kv78turbo.path.calendar");
//     }
// 
//     public static String getChbPath() {
//         return config.getString("distribution.chb.path");
//     }
// 
// 
//     public static String getPlanningLoaderTime() {
//         return config.getString("distribution.planning.loadTime", "03:30");
//     }
// 
//     public static String getPlanningCleanupTime() {
//         return config.getString("distribution.planning.cleanupTime", "04:00");
//     }
// 
// }


import nl.crowndov.displaydirect.distribution.util.CatchableRunnable;
import nl.crowndov.displaydirect.distribution.Configuration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
package nl.crowndov.displaydirect.distribution.input;



/**
 * Copyright 2017 CROW-NDOV
 *
 * This file is subject to the terms and conditions defined in file 'LICENSE.txt', which is part of this source code package.
 */
public class RealTimeProvider {
    private static ExecutorService executor = Executors.newFixedThreadPool(2);
    private static Kv78ReceiveTask receive;
    private static Kv78ProcessTask process;

    public static void start() {
        receive = new Kv78ReceiveTask(Configuration.getZmqInternalPort());
        process = new Kv78ProcessTask(Configuration.getZmqInternalPort());
        executor.submit(new CatchableRunnable(receive, RealTimeProvider.class));
// Path: distribution/src/main/java/nl/crowndov/displaydirect/distribution/util/CatchableRunnable.java
// public class CatchableRunnable implements Runnable {
//     private final Runnable runnable;
//     private final Logger logger;
// 
//     public CatchableRunnable(Runnable runnable, Class c) {
//         this.runnable = runnable;
//         // Allow to customize the class used to log any error messages
//         this.logger = LoggerFactory.getLogger(c);
//     }
// 
//     public CatchableRunnable(Runnable runnable) {
//         this(runnable, CatchableRunnable.class);
//     }
// 
//     @Override
//     public void run() {
//         try {
//             runnable.run();
//         } catch (Exception e) {
//             if (logger != null) {
//                 logger.error("Failed to run task {}, got exception", runnable.toString(), e);
//             }
//         }
//     }
// }
// 
// Path: distribution/src/main/java/nl/crowndov/displaydirect/distribution/Configuration.java
// public class Configuration {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(Configuration.class);
// 
//     private static AbstractConfiguration config = ConfigurationManager.getConfigInstance();
// 
//     public static List<String> getKvEndpoints() {
//         return Arrays.asList(config.getStringArray("distribution.kv78turbo.endpoints"));
//     }
// 
//     public static String[] getKvPublishers() {
//         return config.getStringArray("distribution.kv78turbo.publishers");
//     }
// 
//     public static ZoneId getZoneId() {
//         return ZoneId.of(config.getString("distribution.timezone.default"));
//     }
// 
//     public static String getOutputTransport() {
//         return config.getString("distribution.transport", "mqtt");
//     }
// 
//     public static String getMqttBrokerHost() {
//         return config.getString("distribution.mqtt.host", "localhost:1883");
//     }
// 
//     public static int getZmqInternalPort() {
//         return 9800;
//     }
// 
//     public static String getMqttClientId() {
//         return config.getString("distribution.mqtt.client_id", "distribution");
//     }
// 
//     public static int getAuthorizationTokenMaxAge() {
//         return config.getInt("distribution.authorization.max_age_hours");
//     }
// 
//     public static List<String> getAuthorizationWhitelist() {
//         return Arrays.asList(config.getStringArray("distribution.authorization.whitelist_prefix"));
//     }
// 
//     public static String getBaseUrl() {
//         return config.getString("distribution.install.base_url", "http://localhost:8080");
//     }
// 
//     public static String getSmtpUsername() {
//         return config.getString("distribution.smtp.username", null);
//     }
// 
//     public static String getSmtpPassword() {
//         return config.getString("distribution.smtp.password", null);
//     }
// 
//     public static String getSmtpFrom() {
//         return config.getString("distribution.smtp.from");
//     }
// 
//     public static String getSmtpHostname() {
//         return config.getString("distribution.smtp.hostname");
//     }
// 
//     public static String getSmtpReplyTo() {
//         return config.getString("distribution.smtp.reply_to");
//     }
// 
//     public static boolean getSmtpSsl() { return config.getBoolean("distribution.smtp.ssl", false); }
// 
//     public static int getSmtpPort() {
//         return config.getInt("distribution.smtp.port", 25);
//     }
// 
//     public static int getSmtpConnectTimeout() {
//         return  config.getInt("distribution.smtp.connect_timeout", 10*1000);
//     }
// 
//     public static String getFileBasePath() {
//         return config.getString("distribution.backup.path", System.getProperty("java.io.tmpdir"));
//     }
// 
//     public static String getKv7PlanningPath() {
//         return config.getString("distribution.kv78turbo.path.planning");
//     }
// 
//     public static String getKv7CalendarPath() {
//         return config.getString("distribution.kv78turbo.path.calendar");
//     }
// 
//     public static String getChbPath() {
//         return config.getString("distribution.chb.path");
//     }
// 
// 
//     public static String getPlanningLoaderTime() {
//         return config.getString("distribution.planning.loadTime", "03:30");
//     }
// 
//     public static String getPlanningCleanupTime() {
//         return config.getString("distribution.planning.cleanupTime", "04:00");
//     }
// 
// }


// Path: distribution/src/main/java/nl/crowndov/displaydirect/distribution/input/RealTimeProvider.java
import nl.crowndov.displaydirect.distribution.util.CatchableRunnable;
import nl.crowndov.displaydirect.distribution.Configuration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

package nl.crowndov.displaydirect.distribution.input;



/**
 * Copyright 2017 CROW-NDOV
 *
 * This file is subject to the terms and conditions defined in file 'LICENSE.txt', which is part of this source code package.
 */
public class RealTimeProvider {
    private static ExecutorService executor = Executors.newFixedThreadPool(2);
    private static Kv78ReceiveTask receive;
    private static Kv78ProcessTask process;

    public static void start() {
        receive = new Kv78ReceiveTask(Configuration.getZmqInternalPort());
        process = new Kv78ProcessTask(Configuration.getZmqInternalPort());
        executor.submit(new CatchableRunnable(receive, RealTimeProvider.class));
        executor.submit(new CatchableRunnable(process, RealTimeProvider.class));