LINUX.ORG.RU

История изменений

Исправление bvn13, (текущая версия) :

верно. получилось так:

public String enqueueMessage(String queueName, String messageText) {
        try {
            ObjectName name = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queueName);
            QueueViewMBean destinationMBean = (QueueViewMBean) MBeanServerInvocationHandler.newProxyInstance(this.getJmxConnector( ).getMBeanServerConnection( ), name, QueueViewMBean.class, true);

            return destinationMBean.sendTextMessage(messageText);

        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            createJmxConnection();
        }
        return null;
    }

Исходная версия bvn13, :

верно. получилось так:

public String enqueueMessage(String queueName, String messageText) {
        try {
            ObjectName name = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queueName);
            QueueViewMBean destinationMBean = (QueueViewMBean) MBeanServerInvocationHandler.newProxyInstance(this.getJmxConnector( ).getMBeanServerConnection( ), name, QueueViewMBean.class, true);

            return destinationMBean.sendTextMessage(messageText);

        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            createJmxConnection();
        }
        return null;
    }
[/java]