Search code examples
tibcoems

TIBCO EMS set queue exclusive property programmatically


How can I set the exclusive/non-exclusive property of a tibco queue programmatically? I want to be able to set the queue as non-exclusive when I crate it in my application.

For example, if I use the following code to craete the queue:

QueueConnectionFactory factory = new TIBCO.EMS.QueueConnectionFactory(serverUrl);

QueueConnection connection = factory.CreateQueueConnection(userName, password);

QueueSession session = connection.CreateQueueSession(false, Session.AUTO_ACKNOWLEDGE);

TIBCO.EMS.Queue queue = session.CreateQueue(queueName);

How can I set the queue's properties?


Solution

  • You will need the TibjmsAdmin API to do that. The JavaDoc of the API can be found here

    Then try this:

    TibjmsAdmin jmsAdmin = new TibjmsAdmin("tcp://localhost:7222", "admin", "admin");
    QueueInfo qi = jmsAdmin.getQueue("my.queue");
    qi.setExclusive(true);
    

    HTH,

    Hendrik