Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post and forget #1292

Merged
merged 16 commits into from
Aug 14, 2020
Merged

Post and forget #1292

merged 16 commits into from
Aug 14, 2020

Conversation

alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Aug 14, 2020

This PR adds an ability to post a command without subscribing to events.

Prior to this PR, it was possible to call CommandRequest.post() ignoring the result of the method. Now the contract is tightened:

  • It is required to subscribe to at least one event before calling post(). Otherwise, IllegalStateException will be thrown suggesting to call observe() or postAndForget() instead.
  • If no events are of interest for the client-side code, postAndForget() should be called. If this method is called and at least one event subscription were requested, the method throws IllegalStateException suggesting to call post() instead.
  • The value returned by post() cannot be ignored.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Aug 14, 2020
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review August 14, 2020 13:19
@codecov
Copy link

codecov bot commented Aug 14, 2020

Codecov Report

Merging #1292 into master will decrease coverage by 0.01%.
The diff coverage is 85.00%.

@@             Coverage Diff              @@
##             master    #1292      +/-   ##
============================================
- Coverage     91.06%   91.04%   -0.02%     
- Complexity     4708     4712       +4     
============================================
  Files           606      606              
  Lines         14992    15005      +13     
  Branches        851      853       +2     
============================================
+ Hits          13652    13662      +10     
- Misses         1072     1077       +5     
+ Partials        268      266       -2     

Copy link
Contributor

@yuri-sergiichuk yuri-sergiichuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-yevsyukov LGTM.

Please consider the minor suggestions below.

client/src/main/java/io/spine/client/CommandRequest.java Outdated Show resolved Hide resolved
client/src/main/java/io/spine/client/CommandRequest.java Outdated Show resolved Hide resolved
client/src/main/java/io/spine/client/CommandRequest.java Outdated Show resolved Hide resolved
client/src/main/java/io/spine/client/CommandRequest.java Outdated Show resolved Hide resolved
alexander-yevsyukov and others added 5 commits August 14, 2020 16:35
... to avoid warnings at the calling sites.
Co-authored-by: Yuri Sergiichuk <23313616+yuri-sergiichuk@users.noreply.github.com>
Also:
  * Improve code layout
@alexander-yevsyukov alexander-yevsyukov merged commit f935763 into master Aug 14, 2020
@alexander-yevsyukov alexander-yevsyukov deleted the post-and-forget branch August 14, 2020 14:05
@dmitrykuzmin dmitrykuzmin mentioned this pull request Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants