diff options
| author | Aidan Skinner <aidan@apache.org> | 2008-08-20 16:29:31 +0000 |
|---|---|---|
| committer | Aidan Skinner <aidan@apache.org> | 2008-08-20 16:29:31 +0000 |
| commit | 74bc9ffe9db4cc43fc761bf0ca1a50a5c409476c (patch) | |
| tree | a1670c848c058e2419b907db9b2f564f1118124e /java/client/src | |
| parent | a8aec3509373a0f393923a1e78b8c907a2c3df37 (diff) | |
| download | qpid-python-74bc9ffe9db4cc43fc761bf0ca1a50a5c409476c.tar.gz | |
QPID-1217: make temporary queue creation actually create the temporary queue.
AMQSession*: consolidate createTemporaryQueue into AMQSession.
ConnectionTest: declare custom exchanges before testing them
TemporaryQueueTest: add test for QPID-1217
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@687383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
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 { |
