Example #1
0
 public void startServer(int port) throws IOException {
   if (AndesConfigurationManager.<Boolean>readValue(AndesConfiguration.TRANSPORTS_MQTT_ENABLED)) {
     Properties configProps = loadConfigurations();
     configProps.put("port", Integer.toString(port));
     serverInit(configProps);
   } else {
     log.warn("MQTT Transport is disabled as per configuration.");
   }
 }
Example #2
0
  /**
   * Load configurations related to MQTT from Andes configuration files.
   *
   * @return Property collection
   * @throws AndesException
   */
  private Properties loadConfigurations() {

    Properties mqttProperties = new Properties();

    mqttProperties.put(
        "port",
        AndesConfigurationManager.readValue(
            AndesConfiguration.TRANSPORTS_MQTT_DEFAULT_CONNECTION_PORT));

    mqttProperties.put(
        "sslPort",
        AndesConfigurationManager.readValue(
            AndesConfiguration.TRANSPORTS_MQTT_SSL_CONNECTION_PORT));

    mqttProperties.put(
        "host",
        AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_MQTT_BIND_ADDRESS));

    return mqttProperties;
  }
Example #3
0
  /**
   * Read configuration properties related to persistent stores and construct semantic object for
   * simple reference.
   */
  public void constructStoreConfiguration() {

    storeConfiguration = new StoreConfiguration();

    storeConfiguration.setMessageStoreClassName(
        (String)
            AndesConfigurationManager.readValue(
                AndesConfiguration.PERSISTENCE_MESSAGE_STORE_HANDLER));

    List<String> messageStoreProperties =
        AndesConfigurationManager.readValueList(
            AndesConfiguration.LIST_PERSISTENCE_MESSAGE_STORE_PROPERTIES);

    for (String messageStoreProperty : messageStoreProperties) {
      storeConfiguration.addMessageStoreProperty(
          messageStoreProperty,
          (String)
              AndesConfigurationManager.readValueOfChildByKey(
                  AndesConfiguration.PERSISTENCE_MESSAGE_STORE_PROPERTY, messageStoreProperty));
    }

    storeConfiguration.setAndesContextStoreClassName(
        (String)
            AndesConfigurationManager.readValue(
                AndesConfiguration.PERSISTENCE_CONTEXT_STORE_HANDLER));

    List<String> contextStoreProperties =
        AndesConfigurationManager.readValueList(
            AndesConfiguration.LIST_PERSISTENCE_CONTEXT_STORE_PROPERTIES);

    for (String contextStoreProperty : contextStoreProperties) {
      storeConfiguration.addContextStoreProperty(
          contextStoreProperty,
          (String)
              AndesConfigurationManager.readValueOfChildByKey(
                  AndesConfiguration.PERSISTENCE_CONTEXT_STORE_PROPERTY, contextStoreProperty));
    }
  }
Example #4
0
 /**
  * get thrift server port
  *
  * @return The port value
  */
 public Integer getThriftServerPort() {
   return AndesConfigurationManager.readValue(AndesConfiguration.COORDINATION_THRIFT_SERVER_PORT);
 }
Example #5
0
 /**
  * get thrift server host ip
  *
  * @return thrift server host ip
  */
 public String getThriftServerHost() {
   return AndesConfigurationManager.readValue(AndesConfiguration.COORDINATION_THRIFT_SERVER_HOST);
 }