-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
In real-life use cases it is a common occurrence to expect an event OR a rejection of a certain type after posting a command.
With the current API, we can observe multiple command results simultaneously by calling the CommandRequest.observe(...) method multiple times, but this process is verbose and inconvenient.
While for Java client, where we have a slightly different API, this would not be as straightforward/beneficial, in our JS client we could add a method like:
Client.observeOneOf(eventTypes, consumer)which would allow behavior like:
client.command(cmd)
// ...
.observeOneOf([UserLoggedIn, UserLogInDenied], ({subscribe, unsubscribe}) => {
subscribe(event => _doSomethingWithEventOrRejection(event, unsubscribe));
})A code construction like this would be much less complicated and verbose than what we need to implement now to achieve the same purpose.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request