Skip to content

Conversation

alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented May 15, 2019

This PR improves the way routing is customized. Previously, we relied on exposed eventRouting() or commandRouting() methods that gave access to customizing the routing schemas either in repository constructors or in onRegistered(). This worked, but unnecessarily exposed the routing schemas to user's repository classes.

New way of routing customization exposes setupEventRouting(), setupCommandRouting(), and setupImportRouting() methods that are called during the Repository.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 got toString() which returns the context name.
  • Simplified routing by first message field.
  • When closed Repository clears its reference to its BoundedContext.
  • Common interface was introduced for StandardRejections.

@alexander-yevsyukov alexander-yevsyukov self-assigned this May 15, 2019
... and use it for routing in tests.
@codecov
Copy link

codecov bot commented May 15, 2019

Codecov Report

Merging #1065 into master will increase coverage by 0.01%.
The diff coverage is 91.69%.

@@             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

@alexander-yevsyukov alexander-yevsyukov changed the title More on state routing Encapsulating routing setup May 16, 2019
…te-routing

# Conflicts:
#	server/src/test/java/io/spine/server/BoundedContextTest.java
…te-routing

# Conflicts:
#	server/src/test/java/io/spine/server/BoundedContextTest.java
@alexander-yevsyukov alexander-yevsyukov changed the title Encapsulating routing setup Encapsulate routing setup May 17, 2019
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review May 17, 2019 07:42
@alexander-yevsyukov
Copy link
Contributor Author

@armiol, @dmdashenkov, PTAL.

Copy link
Contributor

@armiol armiol 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 please see my comments.

import static io.spine.util.Exceptions.newIllegalStateException;

/**
* Obtains the first field from multiple messages expecting each field
Copy link
Contributor

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.

@alexander-yevsyukov
Copy link
Contributor Author

@armiol, PTAL again.

@alexander-yevsyukov alexander-yevsyukov merged commit fd82b81 into master May 17, 2019
@alexander-yevsyukov alexander-yevsyukov deleted the more-on-state-routing branch May 17, 2019 10:57
@alexander-yevsyukov alexander-yevsyukov added the /Routing Issues related to signal routing label Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
/Routing Issues related to signal routing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants