Hi Hasitha, Please find the created jiira [1]
I used AndesAdminService. I could get the number of messages successfully by using the getMessageCount with parameter queueName and the pattern as "queue" method as well as with getQueueByName method. [1] https://wso2.org/jira/browse/MB-1797 Shazni Nazeer Associate Technical Lead | WSO2 Mob : +94 777737331 LinkedIn : http://lk.linkedin.com/in/shazninazeer Blog : http://shazninazeer.blogspot.com <http://wso2.com/signature> On Mon, Sep 26, 2016 at 5:09 AM, Hasitha Hiranya <[email protected]> wrote: > Hi Shazni, > > Could you please raise a bug in jira for WSO2 MB. We will track and fix if > there is an issue. > > Thanks > > > > On Sun, Sep 25, 2016 at 10:36 PM, Shazni Nazeer <[email protected]> wrote: > >> Hi Hasitha, >> >> Thanks. Yes i can use it. I'll try to use the AndesAdminService and let >> know the results. >> >> However, it's better if we can determine what's wrong with the coding >> approach. Coding would make things lot more easier to handle other >> scenarios that may come by. >> >> Shazni Nazeer >> Associate Technical Lead | WSO2 >> >> Mob : +94 777737331 >> LinkedIn : http://lk.linkedin.com/in/shazninazeer >> Blog : http://shazninazeer.blogspot.com >> >> <http://wso2.com/signature> >> >> On Fri, Sep 23, 2016 at 10:05 AM, Hasitha Hiranya <[email protected]> >> wrote: >> >>> Hi Shazni, >>> >>> WSO2 Message Broker exposes Admin Services which you can get message >>> count of a queue. >>> Is there any chance of using that? >>> >>> Thanks >>> >>> On Fri, Sep 23, 2016 at 2:21 PM, Shazni Nazeer <[email protected]> wrote: >>> >>>> HI, >>>> >>>> I have the following code snippet to calculate the number of message in >>>> the JMS queue in Message Broker. >>>> >>>> ctx = new InitialContext(properties); >>>> QueueConnectionFactory connectionFactory = >>>> (QueueConnectionFactory) ctx.lookup(CF_NAME); >>>> queueConnection = connectionFactory.createQueueConnection(); >>>> >>>> queueSession = queueConnection.createQueueSession(false, >>>> QueueSession.AUTO_ACKNOWLEDGE); >>>> Queue queue = (Queue) ctx.lookup(destinationName); >>>> >>>> QueueBrowser queueBrowser = queueSession.createBrowser(queue); >>>> >>>> queueConnection.start(); >>>> >>>> Enumeration e = queueBrowser.getEnumeration(); >>>> int numMsgs = 0; >>>> >>>> while (e.hasMoreElements()) { >>>> Message message = (Message) e.nextElement(); >>>> numMsgs++; >>>> } >>>> >>>> >>>> When the statement e.nextElement(); is executed it throws an >>>> exception. The error message I could see in the debug session when >>>> executing this line is "java.lang.ClassCastException: >>>> org.wso2.andes.client.message.CloseConsumerMessage cannot be cast to >>>> org.wso2.andes.client.message.AbstractJMSMessage" >>>> >>>> What's wrong with this snippet? Why is it retrieving >>>> CloseConsumerMessage? >>>> >>>> Is there any better way to determine the number of messages in the >>>> queue programmatically? >>>> >>>> Shazni Nazeer >>>> Associate Technical Lead | WSO2 >>>> >>>> Mob : +94 777737331 >>>> LinkedIn : http://lk.linkedin.com/in/shazninazeer >>>> Blog : http://shazninazeer.blogspot.com >>>> >>>> <http://wso2.com/signature> >>>> >>> >>> >>> >>> -- >>> *Hasitha Abeykoon* >>> Senior Software Engineer; WSO2, Inc.; http://wso2.com >>> *cell:* *+94 719363063* >>> *blog: **abeykoon.blogspot.com* <http://abeykoon.blogspot.com> >>> >>> >> > > > -- > *Hasitha Abeykoon* > Senior Software Engineer; WSO2, Inc.; http://wso2.com > *cell:* *+94 719363063* > *blog: **abeykoon.blogspot.com* <http://abeykoon.blogspot.com> > >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
