-
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
[2.x] Enable IntegrationBroker
dispatch events regardless of registration order of subscribing and publishing BCs
#1408
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1408 +/- ##
============================================
+ Coverage 90.83% 91.10% +0.27%
- Complexity 4884 4907 +23
============================================
Files 624 626 +2
Lines 15326 15342 +16
Branches 891 890 -1
============================================
+ Hits 13921 13978 +57
+ Misses 1104 1063 -41
Partials 301 301 |
server/src/main/java/io/spine/server/integration/AbstractChannelObserver.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/integration/ExternalMessages.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.
Please see my comments.
private static final ChannelId MESSAGE_SOURCES_CHANNEL_ID = channelIdFor( | ||
TypeUrl.of(ExternalMessagesSourceAvailable.class) | ||
); | ||
private static final ChannelId NEEDS_EXCHANGE_CHANNEL_ID = channelIdFor( |
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 the spirit of Ubiquitous Language, let's not use ID
suffix, unless it's absolutely necessary. Since things in modern DDD are referenced by type-safe IDs (and not references to a memory block with an object), having the suffix does not have much meaning.
@yevhenii-nadtochii FYI. For some reason, I am not able to request a review from you. Probably, because you are the original author. However, should you have any comments/questions, let's discuss those vocally. |
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 some minor comments. Will continue reviewing tomorrow.
@@ -90,7 +89,7 @@ | |||
|
|||
/** | |||
* Event dispatchers to be registered with the context {@link EventBus} and/or | |||
* {@link IntegrationBroker} after the Bounded Context creation. | |||
* {@link io.spine.server.integration.IntegrationBroker} after the Bounded Context creation. |
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.
Can we have a short name of the class following the fully-qualified name in the link, please?
*/ | ||
private static ExternalEventType typeOfTransmittedEvents(ChannelId channel) { | ||
return ExternalEventType | ||
.newBuilder() |
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 have .newBuilder()
on the previous line.
*/ | ||
@Override | ||
public void close() throws Exception { | ||
for (ObserveWantedEvents observer : observers) { |
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.
Can we have forEach()
here, please?
* <p>Receives the domain events from other Bounded Contexts and posts them to the domestic | ||
* bus treating them as {@code external}. | ||
*/ | ||
class EventsExchange extends AbstractExchange { |
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.
final
?
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.
LGTM, with few minor comments to address
* @param event | ||
* event to publish | ||
*/ | ||
@Internal |
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.
Do we really need this annotation, assuming that the class is package-private?
* Creates an ID of the channel that will transmit the events of the given class. | ||
*/ | ||
private static ChannelId toChannelId(EventClass cls) { | ||
checkNotNull(cls); |
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.
This null check looks as excessive, assuming we're doing it in private static
method, and the next line calls a method of the passed object, anyway.
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 questions
server/src/main/java/io/spine/server/integration/AbstractChannelObserver.java
Show resolved
Hide resolved
server/src/main/java/io/spine/server/integration/ConfigExchange.java
Outdated
Show resolved
Hide resolved
server/src/main/java/io/spine/server/integration/TransportLink.java
Outdated
Show resolved
Hide resolved
IntegrationBroker
dispatch events regardless of registration order of subscribing and publishing BCs
It's a migration of #1402 to the 2.x branch.
Additionally, the code has been migrated to the latest
McJavaOptions
. The versions of the dependencies were set to the latest available.