qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilyushonak Barys <Barys_Ilyusho...@troika.ru>
Subject RE: Java QMF console classes in org.apache.qpid.console seem very broken!!
Date Fri, 10 Jun 2011 15:20:34 GMT
Hi, fadams

Have you any update?

-----Original Message-----
From: fadams [mailto:fraser.adams@blueyonder.co.uk] 
Sent: Sunday, March 13, 2011 3:18 PM
To: users@qpid.apache.org
Subject: Java QMF console classes in org.apache.qpid.console seem very broken!!

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();
	
qmf.addBroker("amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'");
	}

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

                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 hard-coded.

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 SchemaStatistic.java

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")); setName(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....

MTIA
fadams














--
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


_______________________________________________________

The information contained in this message may be privileged and conf idential and protected
from disclosure. If you are not the original intended recipient, you are hereby notified that
any review, retransmission, dissemination, or other use of, or taking of any action in reliance
upon, this information is prohibited. If you have received this communication in error, please
notify the sender immediately by replying to this message and delete it from your computer.
Thank you for your cooperation. Troika Dialog, Russia. 
If you need assistance please contact our Contact Center  (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp
 



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


Mime
View raw message