Hello,
Thanks Ted for your reply.
I had not copied entire code where we send the message (if I understood
correctly what you meant by sending a method request). I am coping a part
of my code (* complete code you can find on JIRA 955 in the
ManagementClient.java)
SAMPLE CODE
--------
switch (choice)
{
...
.....
case 5:
// send method request AM1M
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 queue class...");
break;
}
message.flip();
// send message
session.data(message);
session.endData();
// confirm completion
session.sync();
........
......
----------
SAMPLE CODE ENDS
In the above code, I am sending a method request (AM1M) for "purge" method
of "queue" class of "qpid" package. this method does not have arguments so
I dont pass here.
Here is the trace which I got when i run the broker with -t option a few
days ago, where i am seeing AM1M (method request)
TRACE
-----
I did trace and put into log.txt.. like this
[EMAIL PROTECTED] ~]# /usr/sbin/qpidd -t --auth no --no-data-dir
--log-output /root/Desktop/log.txt 2008-jul-22 23:36:02 trace RECV
[127.0.0.1:41626]: Frame[Ebe; channel=1; content (22 bytes)
AM1M\00\00\03\E7\00\01\00\00\05\00\00\08...] 2008-jul-22 23:36:02 debug No
messages to dispatch on queue 'management' 2008-jul-22 23:36:02 trace SENT
[127.0.0.1:41626]: Frame[BEbe; channel=1; {MessageAcceptBody: transfers={
[251,251] }; }] 2008-jul-22 23:36:02 debug No messages to dispatch on queue
'management' 2008-jul-22 23:36:02 trace RECV [127.0.0.1:41626]: Frame[BEbe;
channel=1; {MessageCancelBody: destination=listener_management; }]
2008-jul-22 23:36:02 trace RECV [127.0.0.1:41626]: Frame[BEbe; channel=1;
{MessageSubscribeBody: queue=reply; destination=listener_reply;
accept-mode=1; acquire-mode=0; resume-id=; resume-ttl=0; arguments={}; }]
2008-jul-22 23:36:02 trace RECV [127.0.0.1:41626]: Frame[BEbe; channel=1;
{MessageFlowBody: destination=listener_reply; unit=1; value=4294967295; }]
2008-jul-22 23:36:02 debug No messages to dispatch on queue 'reply'
2008-jul-22 23:36:02 trace RECV [127.0.0.1:41626]: Frame[BEbe; channel=1;
{MessageFlowBody: destination=listener_reply; unit=0; value=15; }]
2008-jul-22 23:36:02 debug No messages to dispatch on queue 'reply'
2008-jul-22 23:36:02 trace RECV [127.0.0.1:41626]: Frame[BEbe; channel=1;
{ExecutionSyncBody: }] 2008-jul-22 23:36:02 debug No messages to dispatch
on queue 'reply' ----- END OF TRACE
*** I am using the "agent" routing key.
In addition, I dont know how to send arguments in the method request
(AM1M)... So I take an example of a method request for a method which has
arguments such as "echo" method of "broker" class so I assume we send the
method request something like this..
PLEASE correct me if this is the wrong way???
SAMPLE CODE BEGINS
----------
....
....
case: 5
mgtclient.opcode="AM1M";
mgtclient.sequenceNo=999;
mgtclient.methodName="echo";
// int wht we receive in the schema
mgtclient.argSequence=123;
// string wht we receive in the schema
mgtclient.argBody = "anything";
try {
message.put(mgtclient.opcode.getBytes("UTF-8"));
message.putInt(mgtclient.sequenceNo);
message.putLong(mgtclient.objectID);
encoder.writeStr8(mgtclient.methodName);
// passing arguments
encoder.writeUnit32(mgtclient.argSequence);
encoder.writeStr8(mgtclient.argBody);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
------
SAMPLE CODE ENDS
I am not sure we send the method request with the arguments like this.
Please advice ???
One more Question, how to map the setAttribute() method to the method
request so that when the remore management application make change in the
attributes then the changes get reflected inside the BROKER?
Thanks in advance.
BR,
Rahul
On Aug 5 2008, Ted Ross wrote:
[EMAIL PROTECTED] wrote:
> Hello Ted/Carl,
>
> Could you please reply the following email? I am struck with the
> Method Request (AM1M) (mapping for setAttribute() and method request
> e.g. echo) and Method Response (AM1m).
>
> Just wanted to remind you about this email.
>
> Thank you in advance.
>
> Best Regards,
> Rahul
>
>
> 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 your transmit code above, I don't see where you actually send the
message. You encode the message then print a line saying it was sent
but I don't see where you set attributes and send the message. What
routing key are you using?
If you turn tracing on in the broker (-t command line switch), do you
see the AM1M message being received?
-Ted