1 Reply Latest reply on Dec 2, 2013 5:05 AM by Andy Taylor

    Class cast exception with management Queue hornet

    Dishant Anand Newbie

      Hi Fellas,

       

      i am trying to count total number of messages on the honretQ using the core management api

       

      i configured a management queue named jms.queue.hornetq.management in the honret configurations and then i tried with the following code after my producer sends my message onto the queue

       

      ClientSession managedsession = MyCoreSession.getSession();

        ClientRequestor requestor = new ClientRequestor(managedsession, "jms.queue.hornetq.management");

        ClientMessage messagemanaged = managedsession.

        createMessage(false);

        ManagementHelper.putAttribute(messagemanaged, "jms.queue.myTestQueue","messageCount");

        ClientMessage reply = requestor.request(messagemanaged,1000);

        int count = (Integer) ManagementHelper.getResult(reply);

        System.out.println("There are " + count + " messages in exampleQueue");

       

       

       

      Error obtained is :-

       

      creating session at Mon Dec 02 08:50:59 GMT 2013

       

      message sent successfully

      Received TextMessage:1;02/20/2012 14:01:59.010;1020,1021,1022

      java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

        at org.demo.MyCoreSyncronousTest.main(MyCoreSyncronousTest.java:54)

       

       

      Message count has to be a integer and i dont know what reply i am getting clearly not getting it

       

      Can somebody please help me on this?

       

      Regards

      d.synchronized