/** * Creates a configuration for a consumer using an xml file. * * @param xmlConfigFilePath The file path for the xml configuration file path. * @throws AndesClientConfigurationException */ public AndesJMSConsumerClientConfiguration(String xmlConfigFilePath) throws AndesClientConfigurationException { super(xmlConfigFilePath); try { XMLConfiguration config = new XMLConfiguration(xmlConfigFilePath); this.unSubscribeAfterEachMessageCount = config.getLong("base.consumer.unSubscribeAfterEachMessageCount", Long.MAX_VALUE); this.rollbackAfterEachMessageCount = config.getLong("base.consumer.rollbackAfterEachMessageCount", Long.MAX_VALUE); this.commitAfterEachMessageCount = config.getLong("base.consumer.commitAfterEachMessageCount", Long.MAX_VALUE); this.acknowledgeAfterEachMessageCount = config.getLong("base.consumer.acknowledgeAfterEachMessageCount", Long.MAX_VALUE); this.filePathToWriteReceivedMessages = config.getString("base.consumer.filePathToWriteReceivedMessages", null); this.maximumMessagesToReceived = config.getLong("base.consumer.maximumMessagesToReceived", Long.MAX_VALUE); this.subscriptionID = config.getString("base.consumer.subscriptionID", null); this.durable = config.getBoolean("base.consumer.durable", false); this.async = config.getBoolean("base.consumer.async", true); this.selectors = config.getString("base.consumer.selectors", null); this.acknowledgeMode = JMSAcknowledgeMode.valueOf(config.getString("base.consumer.acknowledgeMode", "AUTO_ACKNOWLEDGE")); } catch (ConfigurationException e) { throw new AndesClientConfigurationException("Error in reading xml configuration file. Make sure the file exists.", e); } catch (IllegalArgumentException e) { throw new AndesClientConfigurationException("Invalid acknowledge mode used. Use a value either of the values : SESSION_TRANSACTED, AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE", e); } }
parameterValue = config.getInt(key); } else if("Long".equalsIgnoreCase(parameterType)){ parameterValue = config.getLong(key); } else if("Float".equalsIgnoreCase(parameterType)){ parameterValue = config.getFloat(key);
parameterValue = config.getInt(key); } else if("Long".equalsIgnoreCase(parameterType)){ parameterValue = config.getLong(key); } else if("Float".equalsIgnoreCase(parameterType)){ parameterValue = config.getFloat(key);
/** * Creates a configuration for a publisher using an xml file. * * @param xmlConfigFilePath The file path for the xml configuration file path. * @throws AndesClientConfigurationException */ public AndesJMSPublisherClientConfiguration(String xmlConfigFilePath) throws AndesClientConfigurationException { super(xmlConfigFilePath); try { XMLConfiguration config = new XMLConfiguration(xmlConfigFilePath); numberOfMessagesToSend = config.getLong("base.publisher.numberOfMessagesToSend", 10L); jmsMessageExpiryTime = config.getLong("base.publisher.jmsMessageExpiryTime", 0L); readMessagesFromFilePath = config.getString("base.publisher.readMessagesFromFilePath", null); jmsMessageType = JMSMessageType.valueOf(config.getString("base.publisher.jmsMessageType", "TEXT")); filePathToWritePublishedMessages = config.getString("base.publisher.filePathToWritePublishedMessages", null); JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5); } catch (ConfigurationException e) { throw new AndesClientConfigurationException("Error in reading xml configuration file. Make sure the file exists.", e); } catch (IllegalArgumentException e) { throw new AndesClientConfigurationException("Invalid message type used. Use either 'TEXT', 'BYTE', 'MAP', 'OBJECT' or 'STREAM'.", e); } }
Configuration(final String configPath) { try { config = new XMLConfiguration(configPath); FileChangedReloadingStrategy reloadStrategy = new FileChangedReloadingStrategy(); reloadStrategy.setRefreshDelay(config.getLong("refresh", 6000)); config.setReloadingStrategy(reloadStrategy); config.addConfigurationListener(event -> init(config)); init(config); } catch (ConfigurationException | PatternSyntaxException e) { throw new IllegalStateException("SerialKiller not properly configured: " + e.getMessage(), e); } }
cycles = config.getLong("iterations");
config.setAutoSave(false); long ver = config.getLong("version");
long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l); log.debug("Setting refreshDelay to " + refreshDelay); FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l); log.debug("Setting refreshDelay to " + refreshDelay); FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
long refreshDelay = xmlConfig.getLong(Property.UDDI_RELOAD_DELAY, 1000l); log.debug("Setting refreshDelay to " + refreshDelay); FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();