Hi, The syntax for a binding URL is as described in the URL you mentioned: <exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
So, for example, a topic would be described as: topic://amq.topic//queuename?routingkey='a.#.c' And a queue would be something similar: direct://amq.direct//queuename Not sure about the MBeans, but the '%' character at the end in the error message would definitely appear to be a bug... Andrew. -- -- andrew d kennedy ? edinburgh : +44 7941 197 134 On 17 November 2010 12:21, Tom Wa <[email protected]> wrote: > Hi, > > I've been trying to set up queues and topics with the java client and broker > (0.6) but have had quite a few problems getting this to work. > > Even basic usage seems to throw errors or do strange things..... > > BindingURL bindingURL = new > AMQBindingURL("direct://amq.direct/SimpleQueue"); > > throws: java.net.URISyntaxException: Error occured while parsing URL at > index 32: direct://amq.direct/SimpleQueue%^ > > I'm guessing the "%^" at the end is a bug. > > Adding a trailing slash seems to make it happy but the binding key in the > Queue and Exchange MBeans are always an empty string so I'm not really > certain it's working correctly or not. Are the MBeans reporting the wrong > data or have I done something wrong? > > > String conn = "amqp://guest:gu...@client1 > /vhost1?brokerlist='tcp://localhost:5672'"; > AMQConnection qpidConnection = new AMQConnection(conn); > qpidConnection.start(); > > Session session = qpidConnection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > BindingURL bindingURL = new > AMQBindingURL("direct://amq.direct/SimpleQueue/"); > Destination dest = new AMQAnyDestination(bindingURL); > > MessageConsumer consumer = session.createConsumer(dest); > > consumer.setMessageListener(new MsgHandler()); > > Using the binding url: "topic://amq.topic/mytest?routingkey='stocks.#'" will > also create a queue with an empty name. Although the binding does seem to > correctly appear in the amq.topic exchange MBean. > > An alternative approach was to use JMS api code. This creates queues in a > direct exchange in a way that the MBean reports correctly however topic > registration simply doesn't seem to work at all. > > queue = new AMQQueue(connection, > "topic://amq.topic/mytest?routingkey='stocks.#'"); > queueSession.createConsumer(queue).setMessageListener(new > MsgHandler()); > > Are there _any_ examples or tests of the java client publishing/consuming > to/from topics _with_routing_keys_ and subjects? > > The only documentation I've found for binding URLs is at > https://cwiki.apache.org/qpid/bindingurlformat.html - is this qpid specific > or part of the spec? > > > Regards, > Tom > --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
