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
This commit is contained in:
James Strachan 2007-02-16 16:54:00 +00:00
parent ee64b03ff5
commit 1a33eb61fb
2 changed files with 28 additions and 7 deletions

View File

@ -73,11 +73,21 @@ public class LegacyFrameTranslator implements FrameTranslator
StringBuffer buffer = new StringBuffer();
if (amq_d.isQueue()) {
if (amq_d.isTemporary()) {
buffer.append("/temp-queue/");
}
else {
buffer.append("/queue/");
}
if (amq_d.isTopic()) {
}
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/");
}
}
}

View File

@ -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;
}