Skip to content
Snippets Groups Projects
Commit 253f807a authored by massakam's avatar massakam Committed by Nozomi Kurihara
Browse files

ReaderHandler starts receiving messages after WebSocket session established (#944)

parent da8acb27
No related merge requests found
......@@ -43,6 +43,7 @@ import org.apache.pulsar.common.naming.DestinationName;
import org.apache.pulsar.common.util.DateFormatter;
import org.apache.pulsar.common.util.ObjectMapperFactory;
import org.apache.pulsar.websocket.data.ConsumerMessage;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
import org.slf4j.Logger;
......@@ -87,7 +88,6 @@ public class ReaderHandler extends AbstractWebSocketHandler {
log.warn("[{}:{}] Failed to add reader handler for topic {}", request.getRemoteAddr(),
request.getRemotePort(), topic);
}
receiveMessage();
} catch (Exception e) {
log.warn("[{}:{}] Failed in creating reader {} on topic {}", request.getRemoteAddr(),
request.getRemotePort(), subscription, topic, e);
......@@ -161,6 +161,12 @@ public class ReaderHandler extends AbstractWebSocketHandler {
});
}
@Override
public void onWebSocketConnect(Session session) {
super.onWebSocketConnect(session);
receiveMessage();
}
@Override
public void onWebSocketText(String message) {
super.onWebSocketText(message);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment