[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-dev
Subject:    Re: Artemis ActiveMQServerControl create queue issue
From:       Brian <brianr () cs ! toronto ! edu>
Date:       2020-01-07 1:02:52
Message-ID: 2A1FD2C5-7AA5-4E1D-B6BF-80BC45AC93BA () cs ! toronto ! edu
[Download RAW message or body]

Hi Justin,

Yes, it all makes sense now. I missed that part in the documentation. Thanks for the quick response!


Brian R

> On Jan 6, 2020, at 11:43, Justin Bertram <jbertram@apache.org> wrote:
> 
> I ran your code and reproduced the issue you're seeing. Everything appears
> to be working as expected. Let me explain...
> 
>> Both addresses get created correctly and the queue on the first address
> gets created correctly but for some reason when I try to create the second
> queue on the second address it tries to put the queue on the first address.
> 
> The broker doesn't try to put the 2nd queue on the first address. It is
> simply reporting that the name of the queue you're attempting to use has
> already been used for a queue which is bound to the first address. In other
> words, queue names must be unique, even across different addresses.
> 
>> Is this normal behaviour, am I missing something here, do I need to have
> one ActiveMQServerControl connection for each address?
> 
> What you're seeing is normal. You don't need one ActiveMQServerControl for
> each address. You just need unique queue names.
> 
> 
> Justin
> 
>> On Sun, Jan 5, 2020 at 8:25 PM Brian Ramprasad <brianr@cs.toronto.edu>
>> wrote:
>> 
>> Hi,
>> 
>> I am trying to create queues on two different addresses using the same
>> ActiveMQServerControl  connection. Both addresses get created correctly and
>> the queue on the first address gets created correctly but for some reason
>> when I try to create the second queue on the second address it tries to put
>> the queue on the first address. Is this normal behaviour, am I missing
>> something here, do I need to have one ActiveMQServerControl connection for
>> each address? That seems strange to me.
>> 
>> 
>> Here is the code I am using to set everything up:
>> 
>> 
>> 
>> import
>> org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
>> 
>> import javax.management.MBeanServerConnection;
>> import javax.management.MBeanServerInvocationHandler;
>> import javax.management.MalformedObjectNameException;
>> import javax.management.ObjectName;
>> import javax.management.remote.JMXConnector;
>> import javax.management.remote.JMXConnectorFactory;
>> import javax.management.remote.JMXServiceURL;
>> import java.io.IOException;
>> 
>> import static java.lang.Boolean.FALSE;
>> 
>> public class TestQueueBroker {
>> 
>> 
>> 
>> 
>>    public static void main (String args[]) throws Exception {
>> 
>> 
>>        TestQueueBroker tqb = new TestQueueBroker();
>> 
>>        tqb.setupActiveMQServerControlConnection("192.168.0.240");
>> 
>>        tqb.init();
>>    }
>> 
>> 
>>    ActiveMQServerControl serverControl;
>>    MBeanServerConnection connection;
>> 
>>    public TestQueueBroker() throws Exception {
>> 
>> 
>>    }
>> 
>>    void init() throws Exception {
>> 
>> 
>>        String topology_address_tp001 = "primary_topology_pipeline_TP_001";
>>        String topology_address_tp002 = "primary_topology_pipeline_TP_002";
>> 
>> 
>> 
>>        this.serverControl.createAddress(topology_address_tp001,"ANYCAST");
>>        this.serverControl.createAddress(topology_address_tp002,"ANYCAST");
>> 
>>        String new_queue_name = "_to_be_forwarded";
>>        String queueFilter = "";
>>        Boolean is_durable = FALSE;
>>        String queueType = "ANYCAST";
>> 
>>        this.serverControl.createQueue(topology_address_tp001,
>> new_queue_name, queueFilter, is_durable ,queueType);
>>        this.serverControl.createQueue(topology_address_tp002,
>> new_queue_name, queueFilter, is_durable ,queueType);
>> 
>> 
>>    }
>> 
>> 
>> 
>>    void setupActiveMQServerControlConnection(String broker_ip) throws
>> IOException, MalformedObjectNameException {
>> 
>>        //Setup the mBean server that we will use for all operations
>>        JMXConnector connector = JMXConnectorFactory.connect(new
>> JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + broker_ip +
>> ":3000/jmxrmi"));
>>        connector.connect();
>>        this.connection = connector.getMBeanServerConnection();
>> 
>>        String beanName = "org.apache.activemq.artemis:broker=" +
>> "\"merlin01\"";
>>        ObjectName server_mbeanName = new ObjectName(beanName);
>>        this.serverControl =
>> MBeanServerInvocationHandler.newProxyInstance(connection, server_mbeanName,
>> ActiveMQServerControl.class, true);
>> 
>> 
>>    }
>> 
>> }
>> 
>> 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic