qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Wa <332...@gmail.com>
Subject Binding URL problems with Java Client/Broker
Date Wed, 17 Nov 2010 12:21:47 GMT
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:guest@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message