Hi Folks,

I ran into the following issue when fixing jms compliance tests.

As part of the spec we need to throw
javax.jms.InvalidDestinationExceptionis the name supplied in the
unsubscribe method is not valid.
So in order to detect that

a) The broker should send an error message saying that it didn't find a
queue by that name (slow) OR
b) We maintain a list of topic names on the client side (fast)

I prefer the first approach as we also need to throw an exception if this
topic (queue in topic exchange) has active consumers bound to it.
Here is the method in question. (I have also cut/paste the section from the
java doc)

public void unsubscribe(String name) throws JMSException
   {
       checkNotClosed();

       //send a queue.delete for the subscription
       String queue = _connection.getClientID() + ":" + name;
       AMQFrame frame = QueueDeleteBody.createAMQFrame(_channelId, 0,
queue, false, false, true);
       _connection.getProtocolHandler().writeFrame(frame);
   }
-----------------------------------------------------------------------------------------------------------------------------------------------------

unsubscribe

public void *unsubscribe*(java.lang.String name)
                throws JMSException
<file:///home/rajith/Desktop/jms1.1/doc/api/javax/jms/JMSException.html>

Unsubscribes a durable subscription that has been created by a client.

This method deletes the state being maintained on behalf of the subscriber
by its provider.

It is erroneous for a client to delete a durable subscription while there is
an active MessageConsumer or TopicSubscriber for the subscription, or while
a consumed message is part of a pending transaction or has not been
acknowledged in the session.
*Parameters:*name - the name used to identify this subscription*Throws:*
JMSException<file:///home/rajith/Desktop/jms1.1/doc/api/javax/jms/JMSException.html>-
if the session fails to unsubscribe to the durable subscription due to
some internal 
error.InvalidDestinationException<file:///home/rajith/Desktop/jms1.1/doc/api/javax/jms/InvalidDestinationException.html>-
if an invalid subscription name is specified.
*Since: *1.1 Regards,
Rajith

Reply via email to