Hi Aidan,

I have implemented the view and viewcontent commands but, I haven't
implemented the actual information displaying with those commands, I'm just
printing the output object which I'm getting after invoking remote method.
For viewcontent command I'm taking the messageId as the input using -id or
-messageid arguemnts.

queue view -n message_queue -t 2 <Just display the TabularData object>
queue viewcontent -n message_queue -id 23 <Just Dispaly the CompositeData
object >

If you can tell me how to extract information from TabularData object and
CompositeData object I can finish the implemenation of view and viewcontent
commands which leads to finish the implemenation of move command too.

Thanks inadvance
Lahiru

On Sun, Aug 10, 2008 at 12:15 PM, lahiru gunathilake <[EMAIL PROTECTED]>wrote:

> Hi Martin and Aidan,
>
> On Sat, Aug 9, 2008 at 4:31 PM, Martin Ritchie <[EMAIL PROTECTED]>wrote:
>
>> 2008/8/8 lahiru gunathilake <[EMAIL PROTECTED]>:
>> > Hi Martin,
>> >
>> > Yes, I think Aidan will agree with this idea.
>> >
>> > On Fri, Aug 8, 2008 at 10:27 PM, Martin Ritchie <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >> 2008/8/7 Aidan Skinner <[EMAIL PROTECTED]>:
>> >> > On Thu, Aug 7, 2008 at 6:26 AM, lahiru gunathilake <
>> [EMAIL PROTECTED]>
>> >> wrote:
>> >> >
>> >> >> On Thu, Aug 7, 2008 at 9:13 AM, lahiru gunathilake <
>> [EMAIL PROTECTED]
>> >> >wrote:
>> >> >
>> >> > Hey dude,
>> >> >>> I have implemented the delete command. It works like this,
>> >> >>> queue delete -n ping -v development -t 3 <have to specify the
>> >> virtualhost
>> >> >>> in order to get a single queue object> : This delete top three
>> messages
>> >> from
>> >> >>> the specified queue.
>> >> >
>> >> > Sweet! Now our users can unclog stuck brokers!
>> >> >
>> >> >>> If user didn't give the -t argument all the messages will be
>> deleted
>> >> from
>> >> >>> the queue.
>> >> >
>> >> > I think that's a little risky, I'm quite forgetful and often try to
>> do
>> >> > things before I've had my 3rd cup of tea (which is the one that turns
>> >> > me into a functional person) and I know I'd end up blowing away a
>> >> > queue by mistake. I think this should be an error, or at least a "are
>> >> > you sure? y/N" prompt
>> >> >
>> >> >>> I think the method I'm suppose to call moveMessages and I have to
>> give
>> >> >>> three arguments ( from MessageId, to MessageId,Queue). Could you
>> please
>> >> tell
>> >> >>> me what does those mean.
>> >> >>>
>> >> >> Do you know any way to get MessageId's ?
>> >> >
>> >> > They should be part of the Message object,
>> >> > Queue.getMessagesOnQueue().getMessage().getMessageId()
>> >> >
>> >> > - Aidan
>> >> > --
>> >> > Apache Qpid - World Domination through Advanced Message Queueing
>> >> > http://cwiki.apache.org/qpid
>> >> > "Nine-tenths of wisdom consists in being wise in time." - Theodore
>> >> Roosevelt
>> >>
>> >> When thinking about the usecase for moving message from queue A to
>> >> queue B I think the best thing to do might be to implement the viewing
>> >> of Messages first. This will allow the user to identify the messages
>> >> on the queue and select then provide you with the message ids they
>> >> wish to move.
>> >>
>> >> Having a view command that starts by displaying message ID and header
>> >> information would be a good start.
>> >>
>> >> This will allow the identification of a message which can then be used
>> >> in the move command.
>> >>
>> >> Looking at the jmx method you can do
>> >> view <queue> <num msgs> [<offset>]
>> >
>> > Could you please tell me what is the meaning of "index range" with
>> > viewMessages JMX method. Is it like this,if user wants to delete the top
>> 4
>> > messages in the queue, then from index = 1, to index = 4 or is it
>> something
>> > else.
>>
>> yes the viewMessages parameters are an index to the messages based on
>> their position in the queue. So fromIndex = 1 , toIndex = 4 will give
>> you the first 4 messages on the queue.
>>
>> > And next thing is I want to get some messages in to my broker and test
>> my
>> > implementations. Aidan told me that it can be done by running some
>> > performance test but I tried by running some scripts but there's no
>> messages
>> > in queues.
>>
>> Most of the performance tests will consume all the messages what I
>> would suggest is take a look at the jmsexample.direct Consumer and
>> Producer. If you start the Consumer then run the Producer you should
>> see the Consumer receives the messages and exits. If you run the
>> Producer again then 10 messages should be left on the queue called
>> 'messageQueue'. If you don't run the Consumer first then you will see
>> 'javax.jms.JMSException: 312' as the queue has not been created.
>
> Thanks Martin,now I can have messages in the Queue message_queue  and
> delete command is works fine for me. I have implemented the view command now
> I'm getting TabularData object by calling JMX method viewMessages but it's
> bit of difficult to get the actual information from the TabularData object.
> Can somebody help me to figure out how to get information from TabularData
> object.
>
> This code gives me an Exception, when I run view command like this (queue
> view -n message_queue )
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> TabularData data =
> (TabularData)this.mbsc.invoke(queue,this.method1,params,signature);
>                     Object keys[] = data.keySet().toArray();
>                     CompositeData comdata = data.get(keys);
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> javax.management.openmbean.InvalidKeyException: Argument key's length=11 is
> different from the number of item values, which is 1, specified for the
> indexing rows in this TabularData instance.
>     at
> javax.management.openmbean.TabularDataSupport.checkKeyType(TabularDataSupport.java:805)
>     at
> javax.management.openmbean.TabularDataSupport.get(TabularDataSupport.java:284)
>     at org.apache.qpid.commands.Commandview.viewmessages(Unknown Source)
>     at org.apache.qpid.commands.Commandview.execute(Unknown Source)
>     at org.apache.qpid.CommandExecusionEngine.runcommand(Unknown Source)
>     at org.apache.qpid.CommandLineInterpreter.main(Unknown Source)
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> When there's one message in the queue I tried to print the TabularData
> object using toSting method it display something like this.
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> javax.management.openmbean.TabularDataSupport(tabularType=javax.management.openmbean.TabularType(name=Messages,rowType=javax.management.openmbean.CompositeType(name=Message,items=((itemName=AMQ
> MessageId,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=Header,itemType=javax.management.openmbean.ArrayType(name=[Ljava.lang.String;,dimension=1,elementType=javax.management.openmbean.SimpleType(name=java.lang.String),primitiveArray=false)),(itemName=Redelivered,itemType=javax.management.openmbean.SimpleType(name=java.lang.Boolean)),(itemName=Size(bytes),itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)))),indexNames=(AMQ
> MessageId)),contents={[22]=javax.management.openmbean.CompositeDataSupport(compositeType=javax.management.openmbean.CompositeType(name=Message,items=((itemName=AMQ
> MessageId,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=Header,itemType=javax.management.openmbean.ArrayType(name=[Ljava.lang.String;,dimension=1,elementType=javax.management.openmbean.SimpleType(name=java.lang.String),primitiveArray=false)),(itemName=Redelivered,itemType=javax.management.openmbean.SimpleType(name=java.lang.Boolean)),(itemName=Size(bytes),itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)))),contents={AMQ
> MessageId=22, Header=[Ljava.lang.String;@1f82982, Redelivered=false,
> Size(bytes)=18})})
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Can someone please tell me how to get the actual information and print them
> in to screan.
>
> Thanks in advance
>
> Lahiru
>
>>
>>
>> Cheers
>>
>> Martin
>>
>> > Could you please address my two questions..?
>> >
>> > Thanks in advance
>> > Lahiru
>> >
>> >>
>> >>
>> >> viewMessages(<offset>, <num msg>)
>> >> This will return details of all the messages currently on the queue.
>> >>
>> >> Which includes the messageID in the reply.
>> >> ViewUtility.populateCompositeWithCompositeData shows how the current
>> >> Management interface extracts this information, although it is quite
>> >> generic code I hope it is reasonable clear to read.
>> >>
>> >> from this you can print the msgID list then work up to extracting the
>> >> header and other values for the message which it would be nice to be
>> >> able to specify on command line:
>> >> view <queue> <num msgs> [<offset>] [-show-headers] [-show-content]
>> >>
>> >> This should make implementing move much easier as you don't need to
>> >> progamatically find the ids as the user will provide them
>> >>
>> >> hope that helps
>>
> Exactly helped a lot :-)
>
>>
>> >>
>> >> Martin
>> >>
>> >>
>> >> --
>> >> Martin Ritchie
>> >>
>> >
>>
>>
>>
>> --
>> Martin Ritchie
>>
>
>

Reply via email to