-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Event bus internal improvements #4824
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
Conversation
|
cc @tsegismont , some cleanup required in the PR, just you get the idea of the changes |
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
left a comment
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.
Thanks @vietj
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
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>)