MQ : queueBrowser.getEnumeration(); - Websphere

This is a discussion on MQ : queueBrowser.getEnumeration(); - Websphere ; Joined: Aug 19, 2008 Posts: 42 [Post New]posted Today 12:52:23 AM 0 Quote Edit Hi I am trying browse a queue which has write only permissions and I am trying to catch an exception in catch block and print a ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: MQ : queueBrowser.getEnumeration();

  1. MQ : queueBrowser.getEnumeration();

    Joined: Aug 19, 2008
    Posts: 42

    [Post New]posted Today 12:52:23 AM
    0
    Quote Edit
    Hi

    I am trying browse a queue which has write only permissions and I am trying to catch an exception in catch block and print a message that the queus has only wite permissions in system log depending on the reason code.

    try {

    InitialContext ctx = new InitialContext();
    qcf = (QueueConnectionFactory) ctx.lookup(qcfName);
    queue = (Queue) ctx.lookup(queueName);
    queueConnection = qcf.createQueueConnection();
    queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    queueBrowser = queueSession.createBrowser(queue);
    queueConnection.start();

    Enumeration enum = queueBrowser.getEnumeration();
    while (enum.hasMoreElements()) {
    Message msg = (Message) enum.nextElement();
    count++;
    }
    } catch (NamingException ne) {
    ........
    } catch (JMSException jmse) {
    .....

    } catch (Exception e) {
    ............
    } finally {
    try {
    queueBrowser.close();
    } catch (Exception e) {
    .............
    }

    Since the queue is not browsable when i say queueBrowser.getEnumerations should't it go to catch block . But in mycode it passes through the enumeration to finally block and close the browser.

    Any help is apperiacitaed.

    Thanks
    Smitha

  2. Re: MQ : queueBrowser.getEnumeration();

    Can anyone please let me know if there is there any method that can used to check if the queue is browsable and if not it throws JMS exception.

    Any help would be really appreciated.

+ Reply to Thread