Package org.apache.druid.messages.server
Class MessageRelayResource<MessageType>
java.lang.Object
org.apache.druid.messages.server.MessageRelayResource<MessageType>
Server-side resource for message relaying. Wraps an
Outbox and MessageListener.
The client for this resource is MessageRelayClient.-
Constructor Summary
ConstructorsConstructorDescriptionMessageRelayResource(Outbox<MessageType> outbox, com.fasterxml.jackson.databind.ObjectMapper smileMapper, Class<MessageType> messageClass) -
Method Summary
Modifier and TypeMethodDescriptionhttpGetMessagesFromOutbox(String clientHost, Long epoch, Long watermark, javax.servlet.http.HttpServletRequest req) Retrieve messages from the outbox for a particular client, as aMessageBatchin Smile format.
-
Constructor Details
-
MessageRelayResource
public MessageRelayResource(Outbox<MessageType> outbox, com.fasterxml.jackson.databind.ObjectMapper smileMapper, Class<MessageType> messageClass)
-
-
Method Details
-
httpGetMessagesFromOutbox
public Void httpGetMessagesFromOutbox(String clientHost, Long epoch, Long watermark, @Context javax.servlet.http.HttpServletRequest req) throws IOException Retrieve messages from the outbox for a particular client, as aMessageBatchin Smile format. The messages are retrieved fromOutbox.getMessages(String, long, long). This is a long-polling async method, usingAsyncContextto wait up toGET_MESSAGES_TIMEOUTfor messages to appear in the outbox.- Returns:
- HTTP 200 with Smile response with messages on success; HTTP 204 (No Content) if no messages were put in
the outbox before the timeout
GET_MESSAGES_TIMEOUTelapsed - Throws:
IOException- See Also:
-