/** * Gets the declared output fields for all streams for the component this task is a part of. */ public Map<String, List<String>> getThisOutputFieldsForStreams() { Map<String, List<String>> streamToFields = new HashMap<>(); for (String stream : this.getThisStreams()) { streamToFields.put(stream, this.getThisOutputFields(stream).toList()); } return streamToFields; }
obj.put("componentid", this.getThisComponentId()); List<String> streamList = new ArrayList<>(); streamList.addAll(this.getThisStreams()); obj.put("streams", streamList); obj.put("stream->outputfields", this.getThisOutputFieldsForStreams());
if (!context.getThisStreams().contains(lateTupleStream)) { throw new IllegalArgumentException( "Stream for late tuples must be defined with the builder method withLateTupleStream");
@Test public void testPrepareLateTupleStreamWithoutTs() throws Exception { Map<String, Object> conf = new HashMap<>(); conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 100000); conf.put(Config.TOPOLOGY_BOLTS_WINDOW_LENGTH_DURATION_MS, 20); conf.put(Config.TOPOLOGY_BOLTS_SLIDING_INTERVAL_DURATION_MS, 10); conf.put(Config.TOPOLOGY_BOLTS_LATE_TUPLE_STREAM, "$late"); conf.put(Config.TOPOLOGY_BOLTS_TUPLE_TIMESTAMP_MAX_LAG_MS, 5); conf.put(Config.TOPOLOGY_BOLTS_WATERMARK_EVENT_INTERVAL_MS, 10); testWindowedBolt = new TestWindowedBolt(); executor = new WindowedBoltExecutor(testWindowedBolt); TopologyContext context = getTopologyContext(); // emulate the call of withLateTupleStream method Mockito.when(context.getThisStreams()).thenReturn(new HashSet<>(Arrays.asList("default", "$late"))); try { executor.prepare(conf, context, getOutputCollector()); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Late tuple stream can be defined only when specifying a timestamp field")); } }
/** * Gets the declared output fields for all streams for the * component this task is a part of. */ public Map<String, List<String>> getThisOutputFieldsForStreams() { Map<String, List<String>> streamToFields = new HashMap<>(); for (String stream : this.getThisStreams()) { streamToFields.put(stream, this.getThisOutputFields(stream).toList()); } return streamToFields; }
obj.put("componentid", this.getThisComponentId()); List<String> streamList = new ArrayList<>(); streamList.addAll(this.getThisStreams()); obj.put("streams", streamList); obj.put("stream->outputfields", this.getThisOutputFieldsForStreams());
if (!context.getThisStreams().contains(lateTupleStream)) { throw new IllegalArgumentException("Stream for late tuples must be defined with the builder method withLateTupleStream");