提交 a109d6ad 编写于 作者: R Rossen Stoyanchev

Set heartbeat to 0,0 on CONNECT to message broker

上级 6eea4ad6
......@@ -292,28 +292,14 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
try {
if ((destination == null) || supportsDestination(destination)) {
if (logger.isTraceEnabled()) {
logger.trace("Processing message: " + message);
}
handleInternal(message, messageType, sessionId);
}
}
catch (Throwable t) {
logger.error("Failed to handle message " + message, t);
}
}
protected boolean supportsDestination(String destination) {
for (String prefix : this.destinationPrefixes) {
if (destination.startsWith(prefix)) {
return true;
}
}
return false;
}
protected void handleInternal(Message<?> message, SimpMessageType messageType, String sessionId) {
if (SimpMessageType.CONNECT.equals(messageType)) {
headers.setHeartbeat(0, 0); // TODO: disable for now
message = MessageBuilder.withPayloadAndHeaders(message.getPayload(), headers).build();
RelaySession session = new RelaySession(sessionId);
this.relaySessions.put(sessionId, session);
session.open(message);
......@@ -337,6 +323,20 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
session.forward(message);
}
}
}
catch (Throwable t) {
logger.error("Failed to handle message " + message, t);
}
}
protected boolean supportsDestination(String destination) {
for (String prefix : this.destinationPrefixes) {
if (destination.startsWith(prefix)) {
return true;
}
}
return false;
}
private class RelaySession {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册