Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2385#discussion_r149159775 --- Diff: storm-client/src/jvm/org/apache/storm/transactional/TransactionalTopologyBuilder.java --- @@ -534,9 +559,33 @@ public BoltDeclarer addConfigurations(Map<String, Object> conf) { } @Override + public Map getRASConfiguration() { + for(Map<String, Object> conf : _component.componentConfs) { + if (conf.containsKey(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP)) { + return conf; + } + } + return new HashMap<>(); + } + + @Override public BoltDeclarer addSharedMemory(SharedMemory request) { _component.sharedMemory.add(request); return this; } + + @SuppressWarnings("unchecked") + @Override + public BoltDeclarer addResource(String resourceName, Number resourceValue) { + Map<String, Double> resourcesMap = (Map<String, Double>) getRASConfiguration().get(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP); + + if (resourcesMap == null) { + resourcesMap = new HashMap<>(); + } + resourcesMap.put(resourceName, resourceValue.doubleValue()); + + getRASConfiguration().put(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP, resourcesMap); --- End diff -- And here.
---