Sometimes I want to peek what's the value that is flowing through the steam.
I cannot attach a debugger from my IDE. Because I will see unresolved objects instead of values. If I try to .await().indefinetely()
it will raise an exception.
So I'm looking for something like in java streams I can simply use peek(e -> System.out.println(e))
which will simply print the value.
I have something like below
public Uni<TenantDraft> getTenantById(@PathParam("tenantKey") String tenantKey) {
return tenantService.findByTenantKey(tenantKey)
.onItem().ifNotNull().transform(TenantMapper.INSTANCE::tenantToTenantDraft)
.onItem().ifNull().failWith(ForbiddenException::new);
}
You can either use:
.log()
which will log all the event.invoke(item -> System.out.println(item))