/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a JMS message to invoke the corresponding operation the value from the server resource. * * @param message JMS message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @throws JMSException if an exception occurs while putting the information in the message * @see org.apache.activemq.artemis.api.core.management.ResourceNames */ public static void putOperationInvocation(final Message message, final String resourceName, final String operationName) throws JMSException { try { ManagementHelper.putOperationInvocation(JMSManagementHelper.getCoreMessage(message), resourceName, operationName); } catch (Exception e) { throw JMSManagementHelper.convertFromException(e); } }
/** * Stores an operation invocation in a JMS message to invoke the corresponding operation the value from the server resource. * * @param message JMS message * @param resourceName the name of the server resource * @param operationName the name of the operation to invoke on the server resource * @param parameters the parameters to use to invoke the server resource * @throws JMSException if an exception occurs while putting the information in the message * @see org.apache.activemq.artemis.api.core.management.ResourceNames */ public static void putOperationInvocation(final Message message, final String resourceName, final String operationName, final Object... parameters) throws JMSException { try { ManagementHelper.putOperationInvocation(JMSManagementHelper.getCoreMessage(message), resourceName, operationName, parameters); } catch (Exception e) { throw JMSManagementHelper.convertFromException(e); } }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
/** * Stores an operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final ICoreMessage message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) null); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "listQueues", filter, 1, maxRows); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { if (getName(false) == null) { ManagementHelper.putOperationInvocation(message, "broker", "listAddresses", "\n"); } else if (bindings) { ManagementHelper.putOperationInvocation(message, "broker", "listBindingsForAddress", getName(false)); } else { ManagementHelper.putOperationInvocation(message, "broker", "getAddressInfo", getName(false)); } }
@Override public void setUpInvocation(ClientMessage message) throws Exception { if (getName(false) == null) { ManagementHelper.putOperationInvocation(message, "broker", "listAddresses", "\n"); } else if (bindings) { ManagementHelper.putOperationInvocation(message, "broker", "listBindingsForAddress", getName(false)); } else { ManagementHelper.putOperationInvocation(message, "broker", "getAddressInfo", getName(false)); } }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "deleteAddress", getName(true)); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "deleteAddress", getName(true)); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(true), getRoutingTypes(true)); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(true), getRoutingTypes(true)); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "updateQueue", getName(), getRoutingType(), getMaxConsumers(null), isPurgeOnNoConsumers()); }
@Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "updateQueue", getName(), getRoutingType(), getMaxConsumers(null), isPurgeOnNoConsumers()); }
@Test public void testHandleManagementMessageWithOperationWhichFails() throws Exception { Configuration config = createBasicConfig().setJMXManagementEnabled(false); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server.start(); // invoke attribute and operation on the server CoreMessage message = new CoreMessage(1, 100); ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "thereIsNoSuchOperation"); ICoreMessage reply = server.getManagementService().handleMessage(message); Assert.assertFalse(ManagementHelper.hasOperationSucceeded(reply)); Assert.assertNotNull(ManagementHelper.getResult(reply)); }
@Test public void testHandleManagementMessageWithUnknowResource() throws Exception { Configuration config = createBasicConfig().setJMXManagementEnabled(false); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server.start(); // invoke attribute and operation on the server ICoreMessage message = new CoreMessage(1, 100); ManagementHelper.putOperationInvocation(message, "Resouce.Does.Not.Exist", "toString"); ICoreMessage reply = server.getManagementService().handleMessage(message); Assert.assertFalse(ManagementHelper.hasOperationSucceeded(reply)); Assert.assertNotNull(ManagementHelper.getResult(reply)); }