简体   繁体   中英

Is there a way to create a batch job in dataflow which reads from a pubsub topic?

I have a dataflow pipeline in streaming mode as it reads from a pubsub topic. I wish to modify it to batch mode. I need so inorder to use FlexRS as it is supported only for batch mode. Beam version : 2.13.0

You can look into using BoundedReadFromUnbounded source that allows to convert unbounded collection to bounded.

UnboundedSource<String> unboundedSource  = ...;
PCollection<String> boundedCollection=
     p.apply(Read.from(unboundedSource).withMaxNumRecords(10));

You can also utilize withMaxReadTime

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM