or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cdi-dependency-injection.mdconfiguration.mdcore-runtime.mddata-persistence.mdindex.mdreactive-programming.mdrest-web-services.mdscheduling.mdsecurity.mdtesting.md

reactive-programming.mddocs/

0

# Reactive Programming

1

2

Quarkus provides reactive programming support with Mutiny, reactive messaging, and event-driven architecture for building scalable asynchronous applications.

3

4

## Mutiny Reactive Types

5

6

### Uni Type

7

8

```java { .api }

9

public class Uni<T> {

10

public static <T> Uni<T> createFrom();

11

public Uni<Void> subscribe();

12

public <R> Uni<R> map(Function<? super T, ? extends R> mapper);

13

public <R> Uni<R> flatMap(Function<? super T, Uni<? extends R>> mapper);

14

public Uni<T> onFailure(Class<? extends Throwable> typeOfFailure);

15

}

16

```

17

18

Represents a single asynchronous value or failure.

19

20

### Multi Type

21

22

```java { .api }

23

public class Multi<T> {

24

public static <T> Multi<T> createFrom();

25

public Multi<T> filter(Predicate<? super T> predicate);

26

public <R> Multi<R> map(Function<? super T, ? extends R> mapper);

27

public Multi<T> onItem();

28

}

29

```

30

31

Represents a stream of asynchronous values.

32

33

## Reactive Messaging

34

35

### Message Annotations

36

37

```java { .api }

38

@Target(ElementType.METHOD)

39

@Retention(RetentionPolicy.RUNTIME)

40

public @interface Incoming {

41

String value();

42

}

43

44

@Target(ElementType.METHOD)

45

@Retention(RetentionPolicy.RUNTIME)

46

public @interface Outgoing {

47

String value();

48

}

49

```

50

51

Annotations for reactive message processing.

52

53

**Usage Example:**

54

```java

55

@ApplicationScoped

56

public class MessageProcessor {

57

58

@Incoming("input-channel")

59

@Outgoing("output-channel")

60

public String process(String message) {

61

return message.toUpperCase();

62

}

63

}

64

```