要解决Apache Beam记录的消息标签错误问题,您可以尝试以下方法:
PCollection> input = ...;
PCollection> output = input.apply(ParDo.of(new MyDoFn()).withOutputTags(mainOutputTag, sideOutputTag));
TupleTag mainOutputTag = new TupleTag<>("mainOutput");
TupleTag sideOutputTag = new TupleTag<>("sideOutput");
public class MyDoFn extends DoFn, Integer> {
@ProcessElement
public void processElement(ProcessContext c) {
KV input = c.element();
if (input.getValue() > 10) {
c.output(mainOutputTag, input.getValue());
} else {
c.output(sideOutputTag, input.getValue());
}
}
}
PCollection mainOutput = output.get(mainOutputTag);
PCollection sideOutput = output.get(sideOutputTag);
希望这些解决方法能帮助您解决Apache Beam记录的消息标签错误问题。如果问题仍然存在,请提供更多的代码和错误信息,以便我们更好地帮助您解决问题。