/** * Initializing JMS properties. * The properties in the required options list are mandatory. * Other JMS options can be passed in as key value pairs, key being in the JMS spec or the broker spec. * * @return all the options map. */ private Map<String, String> initJMSProperties() { Map<String, String> carbonPropertyMapping = JMSOptionsMapper.getCarbonPropertyMapping(); List<String> requiredOptions = JMSOptionsMapper.getRequiredOptions(); // getting the required values Map<String, String> transportProperties = new HashMap<>(); requiredOptions.forEach(requiredOption -> transportProperties.put(carbonPropertyMapping.get(requiredOption), optionHolder.validateAndGetStaticValue(requiredOption))); // getting optional values optionHolder.getStaticOptionsKeys().stream() .filter(option -> !requiredOptions.contains(option) && !option.equals("type")) .forEach(option -> transportProperties.put( carbonPropertyMapping.get(option) == null ? option : carbonPropertyMapping.get(option), optionHolder.validateAndGetStaticValue(option))); return transportProperties; }
/** * Initializing JMS properties. * The properties in the required options list are mandatory. * Other JMS options can be passed in as key value pairs, key being in the JMS spec or the broker spec. * * @return all the options map. */ private Map<String, String> initJMSProperties() { List<String> requiredOptions = JMSOptionsMapper.getRequiredOptions(); Map<String, String> customPropertyMapping = JMSOptionsMapper.getCarbonPropertyMapping(); // getting the required values Map<String, String> transportProperties = new HashMap<>(); requiredOptions.forEach(requiredOption -> transportProperties.put(customPropertyMapping.get(requiredOption), optionHolder.validateAndGetStaticValue(requiredOption))); // getting optional values optionHolder.getStaticOptionsKeys().stream() .filter(option -> !requiredOptions.contains(option) && !option.equals("type")).forEach(option -> transportProperties.put(customPropertyMapping.get(option), optionHolder.validateAndGetStaticValue (option))); return transportProperties; } }
Set<String> staticOptionsKeys = optionHolder.getStaticOptionsKeys(); staticOptionsKeys.remove("type"); boolean customMappingEnabled = staticOptionsKeys.size() > 0;