Class AsyncWrapper<K,InputT,OutputT>

java.lang.Object
org.apache.beam.sdk.transforms.DoFn<KV<K,InputT>,OutputT>
org.apache.beam.sdk.transforms.AsyncWrapper<K,InputT,OutputT>
All Implemented Interfaces:
Serializable, HasDisplayData

public class AsyncWrapper<K,InputT,OutputT> extends DoFn<KV<K,InputT>,OutputT>
Class that wraps a dofn and converts it from one which process elements synchronously to one which processes them asynchronously.

For synchronous dofns the default settings mean that many (100s) of elements will be processed in parallel and that processing an element will block all other work on that key. In addition runners are optimized for latencies less than a few seconds and longer operations can result in high retry rates. Async should be considered when the default parallelism is not correct and/or items are expected to take longer than a few seconds to process.

/* NOTE: 1) The wrapped syncFn REQUIRES thread-safety if BOTH parallelism > 1 and the DoFn is stateful. 2) Tagged output multi-outputs are unsupported. 3) StartBundle/finishBundle are invoked per element so any batching or aggregation logic will not behave as expected.

See Also: