2 Replies Latest reply on Mar 12, 2014 10:24 PM by shlamalama

    Core Management Error

    shlamalama

      I'm trying to invoke the "removeMessages" call on a queue. I'm using 2.4.0.Final, running embedded (no container), using only the core api.

       

      Here's my code:

       

                  ClientSession clientSession = _clientSessionFactory.createSession(true, true, 0);

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

                  ClientMessage message = clientSession.createMessage(false);

                  ManagementHelper.putOperationInvocation(message, "core.queue.queue.exampleQueue", "removeMessages", null);

                  ClientMessage respMsg = requestor.request(message);

                  String reply = (String) ManagementHelper.getResult(respMsg);

                  log.info("got reply: " + reply);

                  return reply;

       

      I get this error saying the operation does not exist. Any clue what I could be doing wrong? I have a queue named "queue.exampleQueue", and I am sending messages to it successfully. I've tried using both "null" and empty string as arguments, per the User Guide, both give this error:

       

      WARN: HQ222111: exception while invoking removeMessages on core.queue.queue.exampleQueue

      java.lang.IllegalArgumentException: HQ119069: no operation removeMessages/0

        at org.hornetq.core.server.management.impl.ManagementServiceImpl.invokeOperation(ManagementServiceImpl.java:840)

        at org.hornetq.core.server.management.impl.ManagementServiceImpl.handleMessage(ManagementServiceImpl.java:418)

        at org.hornetq.core.server.impl.ServerSessionImpl.handleManagementMessage(ServerSessionImpl.java:1607)

        at org.hornetq.core.server.impl.ServerSessionImpl.send(ServerSessionImpl.java:1363)

        at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:471)

        at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:633)

        at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:547)

        at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:523)

        at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:635)

        at org.hornetq.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:160)

        at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:107)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

        at java.lang.Thread.run(Thread.java:744)

        • 1. Re: Core Management Error
          gaohoward

          The exposed removeMessages methods require at least one paramter. This error tells that there is no such a method like removeMessages().

          • 2. Re: Core Management Error
            shlamalama

            Ok, working now, part of the problem was, I didn't start the client session, which caused it to hang. But passing null as an argument, in an Object[] did seem to have the operation applied to all messages. So this code worked:

             

                    clientSession = clientSessionFactory.createSession(true, true, 0);

                    clientSession.start();

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

                    message = clientSession.createMessage(false);

                    ManagementHelper.putOperationInvocation(message, "core.queue.queue.exampleQueue", "removeMessages", new Object[]{null});

                    ClientMessage respMsg = requestor.request(message);

                    Integer reply = (Integer) ManagementHelper.getResult(respMsg);

            1 of 1 people found this helpful