qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fadams <fraser.ad...@blueyonder.co.uk>
Subject Java QMF console classes in org.apache.qpid.console seem very broken!!
Date Sun, 13 Mar 2011 12:17:08 GMT
I'm using qpid v0.8 and I'm running the c++ broker.

For a bit of fun I thought that it would be interesting to see if I could
write something like qpid-config in Java. I noticed that there are a bunch
of Java classes in org.apache.qpid.console that mirror the Python classes
used in qpid-config so it seemed pretty plausible....

my rather hacky test class starts out as follows......

import org.apache.qpid.console.ClassKey;
import org.apache.qpid.console.ObjectID;
import org.apache.qpid.console.QMFObject;
import org.apache.qpid.console.Session;

import java.util.*;
import java.io.*;

public class Config
	private Session qmf;

	public Config() {
		qmf = new Session();

	public void listExchanges(String filter) {
                HashMap&lt;String, Object&gt; args = new HashMap&lt;String,

                args.put("_class", "queue");
	        ArrayList queues = qmf.getObjects(args);

System.out.println("queues size " + queues.size());
 		for (QMFObject queue : queues) {
			String queueID = queue.getObjectID().toString();
System.out.println("queueID " + queueID);

			String qname = (String)queue.getProperty("name");
System.out.println("qname " + qname);

Now things started to go wrong right from the start in addBroker() as
org.apache.qpid.console.Broker has a bunch of old BURL style destinations

I hacked those slightly to use new style address syntax but addBroker() hung
a lot eventually giving "Timeout waiting for Broker to Sync" exceptions.

After some digging I realised that handleSchemaResponse in Session wasn't
returning and traced that to problems with SchemaArgument.java,
SchemaMethod.java, SchemaProperty.java, SchemaVariable.java and

These all seemed to have problems with casting String types e.g. in
SchemaVariable populateData there's a line:

setName((String) map.get("name"));

that hangs (there's similar for the other classes)

It looks like map.get("name") doesn't return a string, rather it returns
byte[] so replacing the above line with:

String name = new String((byte[])map.get("name"));

And the equivalent in the other classes got handleSchemaResponse working.

So with all my hacky fixes I got a lot further but unfortunately with my
Config class

HashMap&lt;String, Object&gt; args = new HashMap&lt;String, Object&gt;();
args.put("_class", "queue");
ArrayList queues = qmf.getObjects(args);

only ever seems to get populated with a single queue.

When I try looking up the exchange and binding classes these seem to return
what I'd expect (comparing with qpid-config), but the queue class stubbornly
refuses to return more than one temporary queue.

I added some System.out.println and I'm only getting a single
handleContentIndicator response from the queues = qmf.getObjects(args); call
- though when I tweak to look at binding & exchange that seems more sensible

handleContentIndicator ClassKey name = org.apache.qpid.broker.queue
queues size 1
queueID 0-58-1-0-452
qname TempQueue33822ecd-dbe7-4f5e-9cfc-fdf74b29df26

It feels like I'm on a losing battle.

Does anyone have any thoughts - my "bit of fun" over the weekend has turned
out anything but....


View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Java-QMF-console-classes-in-org-apache-qpid-console-seem-very-broken-tp6166131p6166131.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

View raw message