diff options
Diffstat (limited to 'java/client')
3 files changed, 23 insertions, 30 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 5203a27f42..39f2ad5048 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -1194,7 +1194,29 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic return new TopicSubscriberAdaptor(dest, (C) createExclusiveConsumer(dest, messageSelector, noLocal)); } - public abstract TemporaryQueue createTemporaryQueue() throws JMSException; + public TemporaryQueue createTemporaryQueue() throws JMSException + { + checkNotClosed(); + try + { + AMQTemporaryQueue result = new AMQTemporaryQueue(this); + + // this is done so that we can produce to a temporary queue before we create a consumer + result.setQueueName(result.getRoutingKey()); + createQueue(result.getAMQQueueName(), result.isAutoDelete(), + result.isDurable(), result.isExclusive()); + bindQueue(result.getAMQQueueName(), result.getRoutingKey(), + new FieldTable(), result.getExchangeName(), result); + return result; + } + catch (Exception e) + { + JMSException ex = new JMSException("Cannot create temporary queue"); + ex.setLinkedException(e); + e.printStackTrace(); + throw ex; + } + } public TemporaryTopic createTemporaryTopic() throws JMSException { diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java index aa0ff66545..46a667419d 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java @@ -623,28 +623,6 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic } } - - 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.getRoutingKey(), result.isAutoDelete(), result.isDurable(), result.isExclusive(),null); - sendQueueBind(result.getRoutingKey(), result.getRoutingKey(), new FieldTable(), result.getExchangeName(),result); - result.setQueueName(result.getRoutingKey()); - } - catch (Exception e) - { - throw new JMSException("Cannot create temporary queue" ); - } - return result; - } - - - - //------ Inner classes /** * Lstener for qpid protocol exceptions diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java index 2442b157f1..07e7419426 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java @@ -418,13 +418,6 @@ public final class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, B getProtocolHandler().syncWrite(frame, TxRollbackOkBody.class); } - public TemporaryQueue createTemporaryQueue() throws JMSException - { - checkNotClosed(); - - return new AMQTemporaryQueue(this); - } - public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException { |
