Describe the proposal
Non-existing value
Project reactor does not allow null values. It has the concept of an empty stream to represent a non-existing value. It has the benefit of being null-safe.
When a state does not exist, current state API does not return an empty Mono. Instead, it returns a State object with its value set to null. It is not null-safe. It requires the client to do null check as follows:
GetStateRequest request = new GetStateRequestBuilder("example-store", "test-key").build();
Mono<State<String>> state = daprClient.getState(request, TypeRef.STRING).flatMap(
it -> Mono.justOrEmpty(it.getValue()) // boilerplate code to check null
);
I suggest getState() API returns Mono.empty() when a state does not exist.
Describe the proposal
Non-existing value
Project reactor does not allow null values. It has the concept of an empty stream to represent a non-existing value. It has the benefit of being null-safe.
When a state does not exist, current state API does not return an empty Mono. Instead, it returns a State object with its value set to null. It is not null-safe. It requires the client to do null check as follows:
I suggest
getState()API returnsMono.empty()when a state does not exist.