qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@cs.man.ac.uk
Subject Re: [Fwd: Re: Management Method Request]
Date Wed, 23 Jul 2008 21:06:59 GMT
Hello Carl/Arnaud/Ted,

Thanks for your stimulating reply.

Yes, I am getting the object ID now and using it in the Method Request 
(AM1M).. something like this

......
......
// Getting the object ID in the OnMessage method...
// I am testing it for "queue" package
		case 'g':
		case 'c':
		case 'i':
		// decode the package name
		String pakagename = decoder.readStr8();
		// decode the class name
		String classname = decoder.readStr8();
		System.out.println("Package Name: " + pakagename);
		System.out.println("Class Name: " + classname);
		// decode the schema hash
		decoder.readBin128();
		// decode the timestamp of current sample
		Date d1 = new Date(decoder.readDatetime());
		System.out.println("Current Sample: " + d1.toString());
		// decode the time object was created
		Date d2 = new Date(decoder.readDatetime());
		System.out.println("Object Created: " + d2.toString());
		// decode the time object was deleted
		Date d3 = new Date(decoder.readDatetime());
		System.out.println("Object Deleted: " + d3.toString());
		// Object Id
		long objectID=decoder.readUint64();
		//	long objid=objectID;
		System.out.println("Object Id:   " + objectID);

		// ****** testing it for "queue" package *****
		if(classname.equals("queue"))
		{	this.objectID=objectID;
				
		}
		break;
		............
		............

Sending the Method Request here. I believe this should be like this...

	// send method request AM1M
		case 5:
		// just to verify that what objectID i am getting is correct
		System.out.println(mgtclient.objectID);
		mgtclient.opcode="AM1M";
		mgtclient.sequenceNo=999;
		mgtclient.methodName="purge";
		message.clear();
		try {
		message.put(mgtclient.opcode.getBytes("UTF-8"));
		message.putInt(mgtclient.sequenceNo);
		message.putLong(mgtclient.objectID);
		encoder.writeStr8(mgtclient.methodName);
		} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
		}
         System.out.println("Query Method Request Sent for purge method of 
ueue class...");
			break;

Trying to receive the Method Response here...

	case 'm':
// TODO: this message is not printing... NOT receiving the Method Response
	System.out.println("I am in");
	int statusCode=decoder.readUint16();
	String statusText=decoder.readStr8();
	System.out.println(statusCode);
	System.out.println(statusText);
	break;


-->> I dont know what went wrong here... Why I am not able to receive the 
Method Response(AM1m)



-->> In my previous email regarding how to send the arguments of method 
(e.g. "echo" method of "broker" package) in Method Request, I was more 
concerned about the arguments of the method such as "echo" method, how to 
send them in the Method Request (AM1M)

For example, I copied the "echo" method from the schema (loaded here 
https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/specs/management-schema.xml)

---

 <method name="echo" desc="Request a response to test the path to the 
management agent">
  <arg name="sequence" dir="IO" type="uint32" default="0" /> 
  <arg name="body" dir="IO" type="lstr" default="" /> 
  </method>


-----


So how to send these arguments of method connect in AM1M.. is it something 
like this???

....
....
	mgtclient.opcode="AM1M";
	mgtclient.sequenceNo=999;
	mgtclient.methodName="echo";
	
	try {
	message.put(mgtclient.opcode.getBytes("UTF-8"));
        message.putInt(mgtclient.sequenceNo);
	message.putLong(mgtclient.objectID);
	encoder.writeStr8(mgtclient.methodName);
	encoder.writeUnit32(mgtclient.argSequence);	
	encoder.writeStr8(mgtclient.argBody);
	
   } catch (UnsupportedEncodingException e) {
	e.printStackTrace();
	}

....
....



-->> Apart from these, is this a good idea to use data base for storing the 
property values (property, stastic etc) so these values (updated each time) 
will go into tables and we can fetch them from there and expose them as 
MBeans ??? So by this way we will just return the last value cached from 
the update in the mbean



Thank you in advance for making me correct in the above mentioned problems.

BR,
Rahul


On Jul 23 2008, Carl Trieloff wrote:

> 
> Ted is out stick yesterday and now out till Monday -- so I suggest just 
> stub the set methods with a do nothing and get the rest working. I will 
> try find
> it in the code or we can ask him monday.
> 
> Carl.
> 
> -------- Original Message --------
> Subject: 	Re: Management Method Request
> Date: 	Tue, 22 Jul 2008 20:13:36 -0400
> From: 	Carl Trieloff <cctrieloff@redhat.com>
> Reply-To: 	qpid-dev@incubator.apache.org, cctrieloff@redhat.com
> Organization: 	Red Hat
> To: 	qpid-dev@incubator.apache.org
> CC: 	cctrieloff@gmail.com, Ted Ross <tross@redhat.com>
> References: 	<Prayer.1.0.12.0807190102300.11125@webmail2.cs.man.ac.uk> 
> <4883DCBE.4000901@redhat.com> 
> <Prayer.1.0.12.0807210856390.16777@webmail2.cs.man.ac.uk>
> 
> 
> 
> mehtar@cs.man.ac.uk wrote:
> > Hi Carl,
> >
> > Thanks for your email.
> >
> > This is already done over the weekend and left you an offline on IRC. :)
> >
> > But I am not receiving the Method Response (AM1m) of my Method Request 
> > (AM1M) from the broker. ("this is the main problem")
> 
> Are you getting the content updates now with with object id's?
> 
> 2008-jul-22 19:58:26 trace SENT [127.0.0.1:47191]: Frame[Ebe; channel=0; 
> content (142 bytes) AM1i\x00\x00\x00\x00\x04qpid\x08ex...]
> 
> 
> 
> >
> > I have three questions:
> > 1. For method names in the class (e.g. "purge" in the "queue" class) 
> > dont have any argument name so will we just send the method name 
> > "purge" in this case ..in the the Method Request (AM1M).. no argument
> yes
> >
> > 2. In the setter methods while translating the attribute (property and 
> > stastic attributes) into MBeans, you mentined that in setMethod() e.g. 
> > setName() for RW (Read/Write).. we will create the AM1M method request 
> > & send to the broker for any change...
> >
> yes  -- problem is the name mapping is not on the wiki -- looking in code
> 
> > But the format of this request is
> >    +-----+-----+-----+-----+-----------------------+
> >    | 'A' | 'M' | '1' | 'M' |          seq          |
> >    +-----+-----+-----+-----+-----------------------+
> >    |  objectId (uint64)                            |
> >    +-----------------------------------------------+
> >    |  methodName (str8)                            |
> >     
> >  
> >  
> > +-----------------------------------------------+------------------------+
> >
> >    | input and bidirectional argument values (in schema order) |
> >     
> >  
> >  
> > +------------------------------------------------------------------------+
> >
> >
> > What will i pass in the methodName (str8)... for example, we can pass 
> > "purge" in case of "queue" package? What can i pass for setter methods ?
> 
> Ted,
> 
> what do you pass for method name to set to set a property?
> 
> I tried
> 
> qpid: call 102 setmgmtPubInterval 2
> Method 'setmgmtPubInterval' not valid for class 'qpid.broker'
> qpid: call 102 mgmtPubInterval 2
> Method 'mgmtPubInterval' not valid for class 'qpid.broker'
> qpid: call 102 set_mgmtPubInterval 2
> Method 'set_mgmtPubInterval' not valid for class 'qpid.broker'
> qpid: call 102 Set_mgmtPubInterval 2
> Method 'Set_mgmtPubInterval' not valid for class 'qpid.broker'
> qpid: call 102 SetmgmtPubInterval 2
> Method 'SetmgmtPubInterval' not valid for class 'qpid.broker'
> 
> 
> will need to get answer from ted tomorrow.
> 
> I take it you worked out that get{propertyName}() will just return the 
> last value cached from the update in the mbean
> 
> >
> >
> >
> > 3. Moreover, I dont know how to send the arguments in the Method 
> > Request... so please give me an example (if possible)... it will 
> > really help me.. you can take "echo" method from the "broker" class by 
> > this way I can learn how we pass the arguments in the Method 
> > Request... :)
> 
> 
>         Method Request
> 
> Method request messages have the following structure. The sequence 
> number is opaque to the management agent. It is returned unchanged in 
> the method reply so the calling client can correctly associate the reply 
> to the request. The objectId is the unique ID of the object on which the 
> method is to be executed.
> 
>         +-----+-----+-----+-----+-----------------------+
>         | 'A' | 'M' | '1' | 'M' |          seq          |
>         +-----+-----+-----+-----+-----------------------+
>         |  objectId (uint64)                            |
>         +-----------------------------------------------+
>         |  methodName (str8)                            |
>          
> +-----------------------------------------------+------------------------+
>         |  input and bidirectional argument values (in schema order) |
>          
> +------------------------------------------------------------------------+
> 
> 
>         Method Response
> 
> Method reply messages have the following structure. The sequence number 
> is identical to that supplied in the method request. The status code 
> (and text) indicate whether or not the method was successful and if not, 
> what the error was. Output and bidirectional arguments are only included 
> if the status code was 0 (STATUS_OK).
> 
>         +-----+-----+-----+-----+-----------------------+
>         | 'A' | 'M' | '1' | 'm' |          seq          |
>         +-----+-----+-----+-----+-----------------------+
>         |  status code          |
>         +-----------------------+----------------------------------+
>         |  status text (str8)                                      |
>          
> +-----------------------+----------------------------------+-------------+
>         |  output and bidirectional argument values (in schema order) |
>          
> +------------------------------------------------------------------------+
> 
> *status code* values are:
> 
> *value* 	*description*
> 0 	STATUS_OK - successful completion
> 1 	STATUS_UNKNOWN_OBJECT - objectId not found in the agent
> 2 	STATUS_UNKNOWN_METHOD - method is not known by the object type
> 3 	STATUS_NOT_IMPLEMENTED - method is not currently implemented
> 
> 
> 
> 
> 
> 

Mime
View raw message