diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2006-12-14 13:57:45 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2006-12-14 13:57:45 +0000 |
commit | e744ff28da15455935660c55813cd242af03495e (patch) | |
tree | 68dd12f671310d33478d39754405d000d2d16619 | |
parent | 0ff5f8deebcac2ba357ca02350f4b203f5b559fb (diff) | |
download | qpid-python-e744ff28da15455935660c55813cd242af03495e.tar.gz |
fixed a merge conflict for TopicPublisherAdapter.java and a possible fix for QPID-183
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@487214 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 14 | ||||
-rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java | 51 |
2 files changed, 38 insertions, 27 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 dbc074beb5..8e93b19eea 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 @@ -28,6 +28,7 @@ import org.apache.qpid.client.message.AbstractJMSMessage; import org.apache.qpid.client.message.JMSStreamMessage; import org.apache.qpid.client.message.MessageFactoryRegistry; import org.apache.qpid.client.message.UnprocessedMessage; +import org.apache.qpid.client.protocol.AMQMethodEvent; import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.client.util.FlowControllingBlockingQueue; import org.apache.qpid.framing.*; @@ -1143,9 +1144,18 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi public void unsubscribe(String name) throws JMSException { checkNotClosed(); - - //send a queue.delete for the subscription + String queue = _connection.getClientID() + ":" + name; + + AMQFrame queueDeclareFrame = QueueDeclareBody.createAMQFrame(_channelId,0,queue,true,false, false, false, true, null); + + try { + AMQMethodEvent event = _connection.getProtocolHandler().syncWrite(queueDeclareFrame,QueueDeclareOkBody.class); + // if this method doen't throw an exception means we have received a queue declare ok. + } catch (AMQException e) { + throw new javax.jms.InvalidDestinationException("This destination doesn't exist"); + } + //send a queue.delete for the subscription AMQFrame frame = QueueDeleteBody.createAMQFrame(_channelId, 0, queue, false, false, true); _connection.getProtocolHandler().writeFrame(frame); } diff --git a/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java b/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java index ea772d0fa1..803f2e03a4 100644 --- a/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java +++ b/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java @@ -43,7 +43,12 @@ public class TopicPublisherAdapter implements TopicPublisher _delegate.send(msg, deliveryMode, priority, timeToLive); } - public void publish(Topic topic, Message msg, int deliveryMode, int priority, long timeToLive) + public int getDeliveryMode() throws JMSException { + checkPreConditions(); + return _delegate.getDeliveryMode(); + } + + public void publish(Topic topic, Message msg, int deliveryMode, int priority, long timeToLive) throws JMSException { checkPreConditions(); @@ -51,41 +56,37 @@ public class TopicPublisherAdapter implements TopicPublisher _delegate.send(topic, msg, deliveryMode, priority, timeToLive); } - public void close() throws JMSException + public void close() throws JMSException { _delegate.close(); } - public int getDeliveryMode() throws JMSException - { - return _delegate.getDeliveryMode(); - } + public boolean getDisableMessageID() throws JMSException { + checkPreConditions(); + return _delegate.getDisableMessageID(); + } + public boolean getDisableMessageTimestamp() throws JMSException { + checkPreConditions(); + return _delegate.getDisableMessageTimestamp(); + } + public Destination getDestination() throws JMSException { + checkPreConditions(); return _delegate.getDestination(); } - public boolean getDisableMessageID() throws JMSException - { - return _delegate.getDisableMessageID(); - } - - public boolean getDisableMessageTimestamp() throws JMSException - { - return _delegate.getDisableMessageTimestamp(); - } - - public int getPriority() throws JMSException - { - return _delegate.getPriority(); - } - - public long getTimeToLive() throws JMSException - { - return _delegate.getTimeToLive(); - } + public int getPriority() throws JMSException { + checkPreConditions(); + return _delegate.getPriority(); + } + public long getTimeToLive() throws JMSException { + checkPreConditions(); + return _delegate.getTimeToLive(); + } + public void send(Message msg) throws JMSException { checkPreConditions(); |