You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by fadams <fr...@blueyonder.co.uk> on 2011/07/17 21:04:37 UTC

QMF2 unbind doesn't seem to work for default direct exchange

I'm trying to do a QMF2 unbind

my code is:

	private void unbind(String[] args) {
		if (args.length < 2) {
			usage();
		}

		String bindingIdentifier = args[0] + "/" + args[1];
		if (args.length > 2) {
			bindingIdentifier = bindingIdentifier + "/" + args[2];
		}

		Map arguments = new HashMap();
		arguments.put("type", "binding");
		arguments.put("name", bindingIdentifier);

System.out.println("unbind " + bindingIdentifier);

		try {
			broker.invokeMethod("delete", arguments);
		} catch (QMFException e) {
			System.out.println(e.getMessage());
		}
	}

but when I supply '' myqueue mykey

the binding identifier ends up /myqueue/mykey

when passed to the Broker.cpp class deleteObject method the name gets passed
to a BindingIdentifier object

struct BindingIdentifier
{
    std::string exchange;
    std::string queue;
    std::string key;

    BindingIdentifier(const std::string& name)
    {
        std::vector<std::string> path;
        split(path, name, "/");
        switch (path.size()) {
          case 1:
            queue = path[0];
            break;
          case 2:
            exchange = path[0];
            queue = path[1];
            break;
          case 3:
            exchange = path[0];
            queue = path[1];
            key = path[2];
            break;
          default:
            throw InvalidBindingIdentifier(name);
        }
    }
};

which doesn't seem to support a null first entry.

I can delete the binding OK with qpid-config, but that uses exchange_unbind
rather than QMF

Any thoughts? Is this a bug with BindingIdentifier?

Regards,
Fraser








--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/QMF2-unbind-doesn-t-seem-to-work-for-default-direct-exchange-tp6592501p6592501.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: QMF2 unbind doesn't seem to work for default direct exchange

Posted by Gordon Sim <gs...@redhat.com>.
On 07/18/2011 09:57 PM, Ken Giusti wrote:
>
>> Kind of related to this - I've not figured out a way to do "--passive" when
>> adding a queue or exchange with QMF2 it doesn't seem to be one of the
>> properties on create queue. Any ideas on that one?
>
>
> It appears that the "--passive" option is only supported by the "queue.declare" and "exchange.declare" AMQP commands, not the broker create() commands available via QMF2.   Not sure if this is by-design, or just missed in the QMF2 case.

It's by design. Creation is different from declaration. The latter was 
supposedly to assert the existence of an object before it was used, with 
the side-effect of creating it if not already there. The create command 
is much more definite. It creates an object. If it is there already you 
get back a response telling you that.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: QMF2 unbind doesn't seem to work for default direct exchange

Posted by Ken Giusti <kg...@redhat.com>.
> Kind of related to this - I've not figured out a way to do "--passive" when
> adding a queue or exchange with QMF2 it doesn't seem to be one of the
> properties on create queue. Any ideas on that one?


It appears that the "--passive" option is only supported by the "queue.declare" and "exchange.declare" AMQP commands, not the broker create() commands available via QMF2.   Not sure if this is by-design, or just missed in the QMF2 case.


-K

----- Original Message -----
> Hi Gordon,
> To be honest I had no particular reason to unbind from the default
> exchange,
> it's just that I'm writing a Java port of qpid-config using QMF2 - and
> in
> the process I seem to be going some way to implementing the QMF2 API
> in Java
> :-) as part of this I've been trying various scenarios and comparing
> with
> the python qpid-config. That was when I noticed that the python one
> allowed
> "" as an exchange name and unbound whereas the QMF2 delete binding
> didn't.
> 
> As long as my code is behaving correctly I'm happy :-)
> 
> 
> Kind of related to this - I've not figured out a way to do "--passive"
> when
> adding a queue or exchange with QMF2 it doesn't seem to be one of the
> properties on create queue. Any ideas on that one?
> 
> 
> 
> Gordon Sim wrote:
> >
> >
> > Actually its a bug with the exchange.unbind operation. It is illegal
> > to
> > unbind (or bind) anything from (or to) the default exchange[1]. The
> > default exchange is a workaround for the fact that up to 0-10 AMQP
> > does
> > not let you publish direct to a queue.
> >
> > Why do you want to unbind from the default exchange?
> >
> >
> >
> 
> 
> --
> View this message in context:
> http://apache-qpid-users.2158936.n2.nabble.com/QMF2-unbind-doesn-t-seem-to-work-for-default-direct-exchange-tp6592501p6596180.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: QMF2 unbind doesn't seem to work for default direct exchange

Posted by fadams <fr...@blueyonder.co.uk>.
Hi Gordon,
To be honest I had no particular reason to unbind from the default exchange,
it's just that I'm writing a Java port of qpid-config using QMF2 - and in
the process I seem to be going some way to implementing the QMF2 API in Java
:-) as part of this I've been trying various scenarios and comparing with
the python qpid-config. That was when I noticed that the python one allowed
"" as an exchange name and unbound whereas the QMF2 delete binding didn't.

As long as my code is behaving correctly I'm happy :-)


Kind of related to this - I've not figured out a way to do "--passive" when
adding a queue or exchange with QMF2 it doesn't seem to be one of the
properties on create queue. Any ideas on that one?



Gordon Sim wrote:
> 
> 
> Actually its a bug with the exchange.unbind operation. It is illegal to 
> unbind (or bind) anything from (or to) the default exchange[1]. The 
> default exchange is a workaround for the fact that up to 0-10 AMQP does 
> not let you publish direct to a queue.
> 
> Why do you want to unbind from the default exchange?
> 
> 
> 


--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/QMF2-unbind-doesn-t-seem-to-work-for-default-direct-exchange-tp6592501p6596180.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: QMF2 unbind doesn't seem to work for default direct exchange

Posted by Gordon Sim <gs...@redhat.com>.
On 07/17/2011 08:04 PM, fadams wrote:
> I'm trying to do a QMF2 unbind
[snip]
> but when I supply '' myqueue mykey
>
> the binding identifier ends up /myqueue/mykey
>
> when passed to the Broker.cpp class deleteObject method the name gets passed
> to a BindingIdentifier object
[snip]
> which doesn't seem to support a null first entry.
>
> I can delete the binding OK with qpid-config, but that uses exchange_unbind
> rather than QMF
>
> Any thoughts? Is this a bug with BindingIdentifier?

Actually its a bug with the exchange.unbind operation. It is illegal to 
unbind (or bind) anything from (or to) the default exchange[1]. The 
default exchange is a workaround for the fact that up to 0-10 AMQP does 
not let you publish direct to a queue.

Why do you want to unbind from the default exchange?

[1] Rule 'default-access' states "The default exchange MUST NOT be 
accessible to the client except by specifying an empty exchange name in 
a content publish command (such as message.transfer). That is, the 
server must not let clients explicitly bind, unbind, delete, or make any 
other reference to this exchange."

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org