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

Use appropriate message id header for STOMP 1.1 vs 1.2

Issue: SPR-14391
上级 2cdcf752
......@@ -67,7 +67,6 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
private static final Message<byte[]> HEARTBEAT;
static {
StompHeaderAccessor accessor = StompHeaderAccessor.createForHeartbeat();
HEARTBEAT = MessageBuilder.createMessage(StompDecoder.HEARTBEAT_PAYLOAD, accessor.getMessageHeaders());
......@@ -93,6 +92,8 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
private volatile TcpConnection<byte[]> connection;
private volatile String version;
private final AtomicInteger subscriptionIndex = new AtomicInteger();
private final Map<String, DefaultSubscription> subscriptions = new ConcurrentHashMap<String, DefaultSubscription>(4);
......@@ -313,7 +314,12 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
@Override
public Receiptable acknowledge(String messageId, boolean consumed) {
StompHeaders stompHeaders = new StompHeaders();
stompHeaders.setId(messageId);
if ("1.1".equals(this.version)) {
stompHeaders.setMessageId(messageId);
}
else {
stompHeaders.setId(messageId);
}
String receiptId = checkOrAddReceipt(stompHeaders);
Receiptable receiptable = new ReceiptHandler(receiptId);
......@@ -407,6 +413,7 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
}
else if (StompCommand.CONNECTED.equals(command)) {
initHeartbeatTasks(stompHeaders);
this.version = stompHeaders.getFirst("version");
this.sessionFuture.set(this);
this.sessionHandler.afterConnected(this, stompHeaders);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册