Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

Current state: [ UNDER DISCUSSION ]Accepted

Discussion thread: <link to mailing list DISCUSS thread>

...

We will introduce new async versions of the UDF AsyncFlatMapFunction.

Public Interfaces

public interface MessageStream<M> {
...
/**
 * Applies the provided 1:n function to transform a message in this {@link MessageStream}
 * to n messages in the transformed {@link MessageStream}
 *
 * @param asyncFlatMapFn the function to transform a message to zero or more messages
 * @param <OM> the type of messages in the transformed {@link MessageStream}
 * @return the transformed {@link MessageStream}
 */
<OM> MessageStream<OM> asyncFlatMap(AsyncFlatMapFunction<? super M, ? extends OM> asyncFlatMapFn);

...
}


/**
* Transforms an input message into a collection of 0 or more messages, possibly of a different type.
*
* @param <M>  type of the input message
* @param <OM>  type of the transformed messages
*/
@InterfaceStability.Unstable
public interface AsyncFlatMapFunction<M, OM> extends InitableFunction, ClosableTask, Serializable {

/**
 * Transforms the provided message into a collection of 0 or more messages.
 *
 * @param message  the input message to be transformed
 * @return  a collection of 0 or more transformed messages
 */
CompletableFuture<Collection<OM>> apply(M message);
}


Implementation and Test Plan

...