@ProcessElement public void processElement( @Element String element, OutputReceiver<KV<String, String>> r) throws Exception { Matcher m = pattern.matcher(element); if (m.find()) { r.output(KV.of(m.group(keyGroupName), m.group(valueGroupName))); } } }));
@ProcessElement public void processElement( @Element KV<K, V> element, @Timestamp Instant timestamp, OutputReceiver<KV<K, TimestampedValue<V>>> r) { r.output( KV.of( element.getKey(), TimestampedValue.of(element.getValue(), timestamp))); } }))
@ProcessElement public void process(@Element Row row, OutputReceiver<String> r) { r.output(row.getString(0) + ":" + row.getInt32(1)); } }));
@ProcessElement public void process(@Element Row row, OutputReceiver<String> r) { r.output( row.getString("string3_field") + ":" + row.getInt32("integer3_field")); } }));
@ProcessElement public void process(@Element Row row, OutputReceiver<String> r) { r.output( row.getString("string2_field") + ":" + row.getInt32("integer2_field")); } }));
@ProcessElement public void process(@Element Row row, OutputReceiver<Row> r) { r.output( Row.withSchema(schema2) .addValues(row.getString(0), row.getInt32(1)) .build()); } }))
@ProcessElement public void processElement( @Element InputT element, OutputReceiver<OutputT> receiver, ProcessContext c) throws Exception { receiver.output( fn.getClosure().apply(element, Fn.Context.wrapProcessContext(c))); }
@OnTimer(timerId) public void onTimer( @Timestamp Instant timestamp, OutputReceiver<KV<Integer, Instant>> r) { r.output(KV.of(42, timestamp)); } };
@OnTimer(timerId) public void onTimer(TimeDomain timeDomain, OutputReceiver<Integer> r) { if (timeDomain.equals(TimeDomain.PROCESSING_TIME)) { r.output(42); } } };
@ProcessElement public void processElement(@TimerId(timerId) Timer timer, OutputReceiver<Integer> r) { timer.offset(Duration.standardSeconds(1)).setRelative(); r.output(3); }
@OnTimer(TIMER_ID) public void onTimer(TimeDomain timeDomain, OutputReceiver<Integer> r) { if (timeDomain.equals(TimeDomain.EVENT_TIME)) { r.output(42); } } };
@OnTimer(timerId) public void onTimer(TimeDomain timeDomain, OutputReceiver<Integer> r) { if (timeDomain.equals(TimeDomain.EVENT_TIME)) { r.output(42); } } };
@ProcessElement public void processElement(@TimerId(timerId) Timer timer, OutputReceiver<Integer> r) { timer.offset(Duration.standardSeconds(1)).setRelative(); r.output(3); }
@ProcessElement public void processElement( @Element KV<String, Integer> element, @StateId(stateId) CombiningState<Integer, MyInteger, Integer> state, OutputReceiver<String> r) { state.add(element.getValue()); Integer currentValue = state.read(); if (currentValue == EXPECTED_SUM) { r.output("right on"); } } };
@ProcessElement public void processElement( @Element KV<Integer, Integer> element, @StateId(stateId) ValueState<Integer> seenState, OutputReceiver<Integer> r) { Integer seen = MoreObjects.firstNonNull(seenState.read(), 0); if (seen == 0) { seenState.write(seen + 1); r.output(element.getValue()); } } };
@ProcessElement public void processElement( @StateId(stateId) ValueState<Integer> state, OutputReceiver<Integer> r) { Integer currentValue = MoreObjects.firstNonNull(state.read(), 0); r.output(currentValue); state.write(currentValue + 1); } };
@ProcessElement public void processElement( @Element T element, @Timestamp Instant timestamp, OutputReceiver<String> r) { checkNotNull(timestamp); r.output("processing: " + element + ", timestamp: " + timestamp.getMillis()); } }
@ProcessElement public void process( @Element InputT element, @Element Row row, OutputReceiver<KV<Row, InputT>> o) { o.output(KV.of(Select.selectRow(row, resolved, schema, keySchema), element)); } }))