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

messagechannel.send() implementation #102

Merged
merged 12 commits into from
Mar 19, 2024
Merged

messagechannel.send() implementation #102

merged 12 commits into from
Mar 19, 2024

Conversation

kmrdhruv
Copy link
Collaborator

Closes #94

  • Implements only send(). publish() and request() to be implemented as needed.
  • Tests to be added post initial review.

Copy link

github-actions bot commented Feb 13, 2024

Test Results

213 tests   213 ✅  34s ⏱️
 47 suites    0 💤
 47 files      0 ❌

Results for commit 1f43d2e.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (08f81cf) 72.37% compared to head (f571f2c) 72.08%.

Files Patch % Lines
...m/flipkart/varadhi/cluster/MessageChannelImpl.java 59.09% 16 Missing and 2 partials ⚠️
...flipkart/varadhi/core/cluster/ResponseMessage.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #102      +/-   ##
============================================
- Coverage     72.37%   72.08%   -0.30%     
- Complexity      502      510       +8     
============================================
  Files           101      103       +2     
  Lines          2201     2246      +45     
  Branches        135      138       +3     
============================================
+ Hits           1593     1619      +26     
- Misses          555      572      +17     
- Partials         53       55       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 23 to 25
void addMessageHandler(String path, MessageHandler messageHandler);

void removeMessageHandler(String path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

add / remove methods dont look like they belong here. They can only remain in Impl class I think.

<E extends ClusterMessage> CompletableFuture<Void> handle(E message);

// request will be used for messages sent via channel.request().
<E extends ClusterMessage> CompletableFuture<ResponseMessage> request(E message);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<E extends ClusterMessage> CompletableFuture<ResponseMessage> request(E message);
<E extends ClusterMessage> CompletableFuture<ResponseMessage> handleRequest(E message);

Does the params need sender info? E message might not have sender info.

log.info("publish({}) message processed.", clusterMessage.getId());
} else {
String deliveryKind = message.headers().get(DELIVERY_KIND_HEADER);
if (DELIVERY_KIND_SEND.equals(deliveryKind)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the checks like "DELIVERY_KIND_SEND.equals(deliveryKind)" required?

Feels redundant. I thought that "expecting" response is kinda implicit due to the api.

For these things to work properly. the sender and reciever needs to be compatible. But having this header does not make it "correct" or enforce correctness.

For eg:
sender could have just "Send" but here we are registering a consumer which actually returns something. So does it mean that the "sender" establishes the expectation of "no response"? But consumer has a response so, is that correct?

The vice-versa is that consumer establishes expectation that there will be response and it is upto sender to ignore that or use that?

Frankly neither feels 100% correct. Which means that the correctness / compatibility enforcement is "implicit". If we get it wrong, well we should have tested it, but there is no way to enforce that in runtime. So the "deliveryKind" header effectively looks redundant as it is not bringing any more validations.

@kmrdhruv kmrdhruv merged commit c213e45 into master Mar 19, 2024
2 checks passed
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.

Implement Message channel/bus/connection for intern node connection
3 participants