Package org.apache.druid.messages
package org.apache.druid.messages
Message relays provide a mechanism to send messages from server to client using long polling. The messages are
sent in order, with acknowledgements from client to server when a message has been successfully delivered.
This is useful when there is some need for some "downstream" servers to send low-latency messages to some
"upstream" server, but where establishing connections from downstream servers to upstream servers would not be
desirable. This is typically done when upstream servers want to keep state in-memory that is updated incrementally
by downstream servers, and where there may be lots of instances of downstream servers.
This structure has two main benefits. First, it prevents upstream servers from being overwhelmed by connections
from downstream servers. Second, it allows upstream servers to drive the updates of their own state, and better
handle events like restarts and leader changes.
On the downstream (server) side, messages are placed into an
Outbox
and served by a MessageRelayResource.
On the upstream (client) side, messages are retrieved by MessageRelays
using MessageRelayClient.
This is currently used by Dart (multi-stage-query engine running on Brokers and Historicals) to implement
worker-to-controller messages. In the future it may also be used to implement
ChangeRequestHttpSyncer.-
ClassesClassDescriptionMessageBatch<T>A batch of messages collected by
MessageRelayfrom a remoteOutboxthroughMessageRelayResource.httpGetMessagesFromOutbox(java.lang.String, java.lang.Long, java.lang.Long, javax.servlet.http.HttpServletRequest).