@DoFn.ProcessElement public void processElement(ProcessContext c) { IndexedRecord in = c.element(); c.output(in.toString()); } }
@ProcessElement public void processElement( @Element String element, @Timestamp Instant timestamp, OutputReceiver<String> r) { r.output(element); System.out.println("Process: " + element + ":" + timestamp.getMillis()); }
@ProcessElement public void processElement(@Element T value, OutputReceiver<T> r) { r.outputWithTimestamp(value, new Instant(value.longValue())); } }
@ProcessElement public void processElement(ProcessContext c, @Element String element) { c.output(element + ":" + c.sideInput(view)); } }
@ProcessElement public void processElement( @Element KV<Integer, Integer> element, @StateId(stateId) GroupingState<Integer, 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( @StateId(stateId) ValueState<Integer> state, OutputReceiver<Integer> r) { Integer currentValue = MoreObjects.firstNonNull(state.read(), 13); r.output(currentValue); state.write(currentValue + 13); } };
@ProcessElement public void reassignTimestamps( ProcessContext context, @Element Long element) { // Shift the latest element as far backwards in time as the model permits context.outputWithTimestamp(element, BoundedWindow.TIMESTAMP_MIN_VALUE); }
@ProcessElement public void processElement( @Element Integer element, MultiOutputReceiver r) { r.get(additionalOutputTag).output(element); } })
@ProcessElement public void process(ProcessContext c, @TimerId("timer") Timer timer) { timer.offset(Duration.standardMinutes(10)).setRelative(); timer.offset(Duration.standardMinutes(30)).setRelative(); }
@ProcessElement public void processElement(ProcessContext context, @TimerId(timerId) Timer timer) { timer.offset(Duration.standardSeconds(1)).setRelative(); context.output(context.element().getValue()); }
@ProcessElement public void processElement( ProcessContext context, @TimerId(timerId) Timer timer, @StateId(stateId) ValueState<String> state, BoundedWindow window) { timer.set(window.maxTimestamp()); state.write(context.element().getKey()); context.output( KV.of(context.element().getKey(), context.element().getValue() + offset)); }
@ProcessElement public void processElement( @StateId(stateId) ValueState<Integer> state, OutputReceiver<KV<String, Integer>> r) { Integer currentValue = MoreObjects.firstNonNull(state.read(), 0); r.output(KV.of("sizzle", currentValue)); state.write(currentValue + 1); } };
@ProcessElement public void processElement(@Element Integer element, OutputReceiver<Integer> r) { r.output(element + 1); } };
@ProcessElement public void processElement( @Element T value, @Timestamp Instant timestamp, OutputReceiver<T> r) { checkNotNull(timestamp); r.outputWithTimestamp(value, timestamp.plus(durationToShift)); } }
@ProcessElement public void process(ProcessContext c) { c.output(c.element()); } }
@ProcessElement public void processElement(ProcessContext c) { // This has to be here. } }
@ProcessElement public void processElement(MultiOutputReceiver r) { r.get(mainOutputTag).output(1); r.get(dummyOutputTag).output(new TestDummy()); } }
@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(ProcessContext context) { context.output(1); } }));
@ProcessElement public void processElement( @Element String element, @Timestamp Instant timestamp, BoundedWindow window, OutputReceiver<String> receiver) { receiver.output( element + ":" + timestamp.getMillis() + ":" + window.maxTimestamp().getMillis()); } }