summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2007-10-26 13:50:39 +0000
committerArnaud Simon <arnaudsimon@apache.org>2007-10-26 13:50:39 +0000
commit58c9477dacefec4ba522aa81c76497710196e274 (patch)
treec979abf42de3abbc9cfba57b98e79d81ec870d46
parent0627679984cb45c95751f21a6a75fbfb4ae6285e (diff)
downloadqpid-python-58c9477dacefec4ba522aa81c76497710196e274.tar.gz
Changed the way temporary queues are created so that we can porduce before creating a consumer
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@588642 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java9
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java23
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java8
3 files changed, 33 insertions, 7 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 01a04aca88..38201f9817 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -1038,13 +1038,8 @@ public abstract class AMQSession extends Closeable implements Session, QueueSess
return new TopicSubscriberAdaptor(dest, (BasicMessageConsumer) createConsumer(dest, messageSelector, noLocal));
}
- public TemporaryQueue createTemporaryQueue() throws JMSException
- {
- checkNotClosed();
-
- return new AMQTemporaryQueue(this);
- }
-
+ public abstract TemporaryQueue createTemporaryQueue() throws JMSException;
+
public TemporaryTopic createTemporaryTopic() throws JMSException
{
checkNotClosed();
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
index 223ba7b510..8af3b106e3 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
import javax.jms.JMSException;
import javax.jms.Destination;
+import javax.jms.TemporaryQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.UUID;
import java.util.Map;
@@ -515,6 +516,28 @@ public class AMQSession_0_10 extends AMQSession
}
}
+
+ public TemporaryQueue createTemporaryQueue() throws JMSException
+ {
+ checkNotClosed();
+ AMQTemporaryQueue result = new AMQTemporaryQueue(this);
+ try
+ {
+ // this is done so that we can produce to a temporary queue beofre we create a consumer
+ sendCreateQueue(result.getDestinationName(), result.isAutoDelete(), result.isDurable(), result.isExclusive());
+ sendQueueBind(result.getDestinationName(), result.getDestinationName(), new FieldTable(), result.getExchangeName());
+ result.setQueueName(result.getDestinationName());
+ }
+ catch (Exception e)
+ {
+ throw new JMSException("Cannot create temporary queue" );
+ }
+ return result;
+ }
+
+
+
+
//------ Inner classes
/**
* Lstener for qpid protocol exceptions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
index 00c4a5365f..8740410bea 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
@@ -23,6 +23,7 @@ package org.apache.qpid.client;
import javax.jms.Destination;
import javax.jms.JMSException;
+import javax.jms.TemporaryQueue;
import org.apache.qpid.AMQException;
import org.apache.qpid.client.failover.FailoverException;
@@ -325,4 +326,11 @@ public class AMQSession_0_8 extends AMQSession
_connection.getProtocolHandler().syncWrite(TxRollbackBody.createAMQFrame(_channelId,
getProtocolMajorVersion(), getProtocolMinorVersion()), TxRollbackOkBody.class);
}
+
+ public TemporaryQueue createTemporaryQueue() throws JMSException
+ {
+ checkNotClosed();
+
+ return new AMQTemporaryQueue(this);
+ }
}