-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allow subscribing on same rejection with different causes #1205
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1205 +/- ##
============================================
+ Coverage 91.49% 91.53% +0.03%
- Complexity 4269 4278 +9
============================================
Files 547 549 +2
Lines 13346 13355 +9
Branches 759 759
============================================
+ Hits 12211 12224 +13
+ Misses 894 892 -2
+ Partials 241 239 -2 |
The getDeclaredMethods may behave differently in IDE and during the Gradle build process.
@armiol PTAL. |
server/src/main/java/io/spine/server/event/model/RejectionDispatchKey.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/event/model/RejectionDispatchKey.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/event/model/SubscriberMethod.java
Outdated
Show resolved
Hide resolved
server/src/test/java/io/spine/server/event/model/RejectionDispatchKeyTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/io/spine/server/event/model/RejectionDispatchKeyTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one minor request for extending EventEnvelope
.
server/src/main/java/io/spine/server/event/model/EventSubscriberMethod.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public DispatchKey key() { | ||
if (parameterSpec().acceptsCommand()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss this one in person. I am not sure I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comment.
server/src/main/java/io/spine/server/event/model/RejectionDispatchKeys.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/event/model/RejectionDispatchKeys.java
Outdated
Show resolved
Hide resolved
# Conflicts: # license-report.md
…atchKeys.java Co-Authored-By: Alexander Yevsyukov <alexander.yevsyukov@teamdev.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuri-sergiichuk please see my comments.
Class<? extends CommandMessage> commandMessageClass = toCommandMessage(parameters[1]); | ||
Class<?> secondParameter = parameters[1]; | ||
checkArgument(CommandMessage.class.isAssignableFrom(secondParameter), | ||
"The method `%s` should have the second parameter assignable from CommandMessage, but has `%s`.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`CommandMessage`
import io.spine.type.MessageClass; | ||
|
||
/** | ||
* A handler method that handles rejections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is capable of handling rejection messages.
It's not that it always handles those. It just may handle.
/** | ||
* {@inheritDoc} | ||
* | ||
* <p>If a handler method spec is for a rejection — creates rejection dispatch key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case this method is declared to handle a rejection, a rejection-specific dispatch key is created.
* <p>If a handler method spec is for a rejection — creates rejection dispatch key. | ||
*/ | ||
@Override | ||
default DispatchKey key() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think, @OverridingMethodsMustInvokeSuper
.
@@ -139,6 +139,9 @@ default void ensureExternalMatch(boolean expectedValue) throws SignalOriginMisma | |||
} | |||
} | |||
|
|||
/** | |||
* Creates a handler method dispatch key out of the {@code message class}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...out of the {@linkplain #messageClass() message class}.
@armiol PTAL again. |
…this specific interface
# Conflicts: # license-report.md
Alex already approved the PR.
This PR fixes #1202.
The
EventHandlerMethod
now shares theDispatchKey
logic with theEventSubscriberMethod
and creates aDispatchKey
for rejections in the very same way.