From 1a33eb61fb5f4a5fb5b3571f49ccb0def5df0331 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 16 Feb 2007 16:54:00 +0000 Subject: [PATCH] added support for temporary destinations and support more polymorphic request/reply logic in clients git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@508489 13f79535-47bb-0310-9956-ffa450edef68 --- .../stomp/LegacyFrameTranslator.java | 26 ++++++++++++++++--- .../transport/stomp/ProtocolConverter.java | 9 ++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java index adcca23352..509cfb9954 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java @@ -73,10 +73,20 @@ public class LegacyFrameTranslator implements FrameTranslator StringBuffer buffer = new StringBuffer(); if (amq_d.isQueue()) { - buffer.append("/queue/"); + if (amq_d.isTemporary()) { + buffer.append("/temp-queue/"); + } + else { + buffer.append("/queue/"); + } } - if (amq_d.isTopic()) { - buffer.append("/topic/"); + else { + if (amq_d.isTemporary()) { + buffer.append("/temp-topic/"); + } + else { + buffer.append("/topic/"); + } } buffer.append(p_name); return buffer.toString(); @@ -94,9 +104,17 @@ public class LegacyFrameTranslator implements FrameTranslator String t_name = name.substring("/topic/".length(), name.length()); return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TOPIC_TYPE); } + else if (name.startsWith("/temp-queue/")) { + String t_name = name.substring("/temp-queue/".length(), name.length()); + return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TEMP_QUEUE_TYPE); + } + else if (name.startsWith("/temp-topic/")) { + String t_name = name.substring("/temp-topic/".length(), name.length()); + return ActiveMQDestination.createDestination(t_name, ActiveMQDestination.TEMP_TOPIC_TYPE); + } else { throw new ProtocolException("Illegal destination name: [" + name + "] -- ActiveMQ STOMP destinations " + - "must begine with /queue/ or /topic/"); + "must begine with one of: /queue/ /topic/ /temp-queue/ /temp-topic/"); } } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java index 2800576330..3590a63283 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java @@ -428,8 +428,14 @@ public class ProtocolConverter { responseHeaders.put(Stomp.Headers.Connected.SESSION, connectionInfo.getClientId()); String requestId = (String) headers.get(Stomp.Headers.Connect.REQUEST_ID); + if (requestId == null) { + // TODO legacy + requestId = (String) headers.get(Stomp.Headers.RECEIPT_REQUESTED); + } if( requestId !=null ){ + // TODO legacy responseHeaders.put(Stomp.Headers.Connected.RESPONSE_ID, requestId); + responseHeaders.put(Stomp.Headers.Response.RECEIPT_ID, requestId); } StompFrame sc = new StompFrame(); @@ -441,7 +447,6 @@ public class ProtocolConverter { } }); - } protected void onStompDisconnect(StompFrame command) throws ProtocolException { @@ -483,9 +488,7 @@ public class ProtocolConverter { } public ActiveMQMessage convertMessage(StompFrame command) throws IOException, JMSException { - ActiveMQMessage msg = frameTranslator.convertFrame(command); - return msg; }