or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

async-operations.mddata-sources.mdfunction-interfaces.mdindex.mdkeyed-streams.mdoutput-operations.mdscala-extensions.mdstream-composition.mdstream-environment.mdstream-partitioning.mdstream-transformations.mdwindow-operations.mdwindowing.md

async-operations.mddocs/

0

# Asynchronous I/O Operations

1

2

High-performance asynchronous I/O operations for external system integration with configurable parallelism, timeouts, and result ordering.

3

4

## Imports

5

6

```scala

7

import org.apache.flink.streaming.api.scala._

8

import org.apache.flink.streaming.api.scala.async.{AsyncFunction, AsyncCollector}

9

import java.util.concurrent.TimeUnit

10

```

11

12

## AsyncDataStream Operations

13

14

```scala { .api }

15

object AsyncDataStream {

16

def unorderedWait[IN, OUT: TypeInformation](

17

input: DataStream[IN],

18

asyncFunction: AsyncFunction[IN, OUT],

19

timeout: Long,

20

timeUnit: TimeUnit

21

): DataStream[OUT]

22

23

def orderedWait[IN, OUT: TypeInformation](

24

input: DataStream[IN],

25

asyncFunction: AsyncFunction[IN, OUT],

26

timeout: Long,

27

timeUnit: TimeUnit

28

): DataStream[OUT]

29

}

30

```

31

32

## AsyncFunction Interface

33

34

```scala { .api }

35

trait AsyncFunction[IN, OUT] {

36

def asyncInvoke(input: IN, collector: AsyncCollector[OUT]): Unit

37

}

38

39

trait AsyncCollector[OUT] {

40

def collect(result: Iterable[OUT]): Unit

41

def collect(throwable: Throwable): Unit

42

}

43

```

44

45

Enables non-blocking I/O operations for database lookups, REST API calls, and other external system interactions.