I'm trying to learn Reactive programming in quarkus and run into a problem. I want to make a simple employee system without any database, just the ArrayList with the Employees but in every article and video tutorial i watched and read , there were all using Databases.Is there a way to use Mutli and Uni in just an ArrayList and Is it worth it at all?
Thanks for your time
Asked
Active
Viewed 133 times
0
1 Answers
1
You can easily do something like:
public class Fruit {
public final String name;
public final String description;
public Fruit(String name, String description) {
this.name = name;
this.description = description;
}
}
@Path("/fruits")
public class FruitResource {
private final Set<Fruit> fruits = Set.of(new Fruit("Apple", "Winter fruit"), new Fruit("Pineapple", "Tropical fruit"));
@GET
public Uni<Set<Fruit>> list() {
return Uni.createFrom().item(fruits);
}
}
where all you are doing is returning a Set
of Fruit
objects via a Uni
- no database or anything

geoand
- 60,071
- 24
- 172
- 190