-
Notifications
You must be signed in to change notification settings - Fork 12
Encapsulate routing setup #1065
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
Conversation
Also: * Allow non-public entity classes to declare columns. * Customize state routing during repo initialization.
... and use it for routing in tests.
Codecov Report
@@ Coverage Diff @@
## master #1065 +/- ##
============================================
+ Coverage 92.87% 92.89% +0.01%
- Complexity 3896 3933 +37
============================================
Files 539 542 +3
Lines 12591 12647 +56
Branches 653 662 +9
============================================
+ Hits 11694 11748 +54
- Misses 684 686 +2
Partials 213 213 |
... instead of factory method.
Also: * clear `boundedContext` link in a repo when closing. Primarily to make tests happy, but also to disallow activity in a context after closing.
... to make Mockito happy :(
…te-routing # Conflicts: # server/src/test/java/io/spine/server/BoundedContextTest.java
…te-routing # Conflicts: # server/src/test/java/io/spine/server/BoundedContextTest.java
@armiol, @dmdashenkov, PTAL. |
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.
@alexander-yevsyukov please see my comments.
server/src/main/java/io/spine/server/entity/rejection/StandardRejection.java
Show resolved
Hide resolved
import static io.spine.util.Exceptions.newIllegalStateException; | ||
|
||
/** | ||
* Obtains the first field from multiple messages expecting each field |
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.
While I understand what you meant, this is only because we have discussed this behaviour previously.
This should be something like this:
Routes messages to a single target, which ID is the same as the first field of the routed message.
<p>It is expected that the types of the first field and the identifier are the same.
server/src/main/java/io/spine/server/route/StateUpdateRouting.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/entity/rejection/StandardRejection.java
Outdated
Show resolved
Hide resolved
@armiol, PTAL again. |
This PR improves the way routing is customized. Previously, we relied on exposed
eventRouting()
orcommandRouting()
methods that gave access to customizing the routing schemas either in repository constructors or inonRegistered()
. This worked, but unnecessarily exposed the routing schemas to user's repository classes.New way of routing customization exposes
setupEventRouting()
,setupCommandRouting()
, andsetupImportRouting()
methods that are called during theRepository.init()
(which is also introduced by this PR).The
init()
is meant to be the place for general purpose customization which may be needed by a user's repository class.The
onRegistered()
callback is left for compatibility reasons, and for the cases when additional configuration is needed after a repository is registered in the Bounded Context.Other notable changes:
BoundedContext
gottoString()
which returns the context name.Repository
clears its reference to itsBoundedContext
.StandardRejection
s.