qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Wa <332...@gmail.com>
Subject Re: Binding URL problems with Java Client/Broker
Date Mon, 22 Nov 2010 09:10:31 GMT
Hi,

Thanks for the confirmation. The examples on the wiki page are incorrect -
I'd be grateful if someone with edit rights could fix them. The testing code
in BindingURLParser also produces unexplained results so I'm just going to
try to avoid using it.

After adding the missing '/' to the examples, the MBean now correctly
displays the queues bound to direct exchanges but not topic exchanges.

I will check out the 0.7 branch and see if this code is more stable. The
addition of 'drain' and 'spout' is certainly welcome.


Regards,
Tom


On Wed, Nov 17, 2010 at 2:32 PM, Andrew Kennedy <
andrewinternational@gmail.com> wrote:

> 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 <332390@gmail.com> 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: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
> >
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

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