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

[2.x] Enable IntegrationBroker dispatch events regardless of registration order of subscribing and publishing BCs #1408

Merged
merged 68 commits into from
Nov 12, 2021

Conversation

yevhenii-nadtochii
Copy link
Contributor

@yevhenii-nadtochii yevhenii-nadtochii commented Oct 28, 2021

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.

@yevhenii-nadtochii yevhenii-nadtochii marked this pull request as ready for review October 28, 2021 14:59
@codecov
Copy link

codecov bot commented Oct 28, 2021

Codecov Report

Merging #1408 (419a37e) into master (6e40708) will increase coverage by 0.27%.
The diff coverage is 89.11%.

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

@armiol armiol marked this pull request as draft November 2, 2021 14:41
@armiol armiol removed the request for review from alexander-yevsyukov November 2, 2021 14:41
@armiol armiol self-assigned this Nov 2, 2021
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a 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(
Copy link
Contributor

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.

@armiol armiol removed their request for review November 11, 2021 18:31
@armiol
Copy link
Contributor

armiol commented Nov 11, 2021

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

@armiol armiol marked this pull request as ready for review November 11, 2021 18:34
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a 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.
Copy link
Contributor

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()
Copy link
Contributor

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) {
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

final?

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a 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
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

@yevhenii-nadtochii yevhenii-nadtochii left a 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

@armiol armiol merged commit a3fe6f8 into master Nov 12, 2021
@armiol armiol deleted the integration-broker-feature branch November 12, 2021 13:25
@armiol armiol changed the title Enable IntegrationBroker dispatch events regardless of registration order of subscribing and publishing BCs [2.x] Enable IntegrationBroker dispatch events regardless of registration order of subscribing and publishing BCs Nov 16, 2021
@armiol armiol changed the title [2.x] Enable IntegrationBroker dispatch events regardless of registration order of subscribing and publishing BCs [2.x] Enable IntegrationBroker dispatch events regardless of registration order of subscribing and publishing BCs Nov 16, 2021
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.

3 participants