diff options
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); + } } |