Merged
Conversation
Member
Author
|
cc @tsegismont , some cleanup required in the PR, just you get the idea of the changes |
Member
It was designed like this so that users can create their own node selector and choose a server depending on metadata provided by messager headers (e..g. implementing sharing on the event bus) |
tsegismont
reviewed
Sep 12, 2023
src/main/java/io/vertx/core/eventbus/impl/clustered/ConnectionHolder.java
Outdated
Show resolved
Hide resolved
src/main/java/io/vertx/core/eventbus/impl/clustered/ClusteredEventBus.java
Outdated
Show resolved
Hide resolved
src/main/java/io/vertx/core/eventbus/impl/clustered/ClusteredEventBus.java
Outdated
Show resolved
Hide resolved
src/main/java/io/vertx/core/eventbus/impl/clustered/ClusteredEventBus.java
Outdated
Show resolved
Hide resolved
src/main/java/io/vertx/core/eventbus/impl/HandlerRegistration.java
Outdated
Show resolved
Hide resolved
6132003 to
eb6744a
Compare
… this usage by MessageImpl instead.
…y not exposed by implementations
eb6744a to
365c383
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See also #4712
Decouple message emission from the interceptor chain
EventBus streaming requires to send messages that does not go through the interceptor chain, e.g. establishing a stream requires to send such messages. The sendOrPub method and the downstream chain of calls (sendLocally, sendOrPublishFailed, sendToNode, sendToNodes) are coupled to OutboundDeliveryContext by convenience. The EventBus#sendOrPub is refactored to carry the messages and the delivery options instead of the OutboundDeliveryContext.
Main changes
EventBusImpl#sendOrPub(OutboundDeliveryContext) -> EventBusimpl#sendOrPub(ContextInternal,MessageImpl,DeliveryOptions,Promise)sendLocally,sendOrPublishFailed,sendToNode,sendToNodesDecouple the RegistrationHandler from the repliedAddress knowledge
The clustered event bus is aware of the nature of the
HandlerHolder: when aHandlerHolderis registered it does broadcast the registration when theHandlerHolderis a reply handler. TheHandlerHolder#isReplyHandler()method is removed, insteadEventBusImpl#addRegistrationreplaces thereplyHandlerboolean by abroadcastboolean, whenbroadcastis set to false theonLocalRegistrationmethod is not called avoiding the clustered event bus to perform the check.Main changes:
HandlerRegistration#register(String repliedAddress, boolean localOnly, Promise<Void> promise)->HandlerRegistration#register(boolean broadcast, boolean localOnly, Promise<Void> promise)HandlerHolderdoes not carry anymore thereplyHandlerbooleanMessageConsumerImplcalls register withbroadcast= trueReplyHandlercalls register withbroadcast= falseClusteredEventBusprocesses a local registration whatsoever as it is not called for reply handlersNodeSelector cleanup
The
NodeSelectorSPI is coupled to event-bus message API, instead it should only care about the message address, this simplifies the API and decouple theNodeSelectorSPI from the message.Main changes:
NodeSelector#selectForSend(Message, Promise<String>)->NodeSelector#selectForSend(String, Promise<String>)