Просмотрите, прочитайте и удалите сообщение из очереди, используя классы IBM MQ

Я пишу простое Java-приложение с использованием классов MQ для Java с Eclipse.

Сейчас я могу просматривать удаленную очередь, не удаляя сохраненные сообщения.
Вот код цикла чтения:

MQQueueManager QMgr = new MQQueueManager(qManager); //<-- qManager is a String with the QMgr name

int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;  

MQQueue queue = QMgr.accessQueue(queueName, openOptions);

MQMessage theMessage    = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
    gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
    gmo.matchOptions=MQC.MQMO_NONE;
    gmo.waitInterval=5000;

boolean thereAreMessages=true;
while(thereAreMessages){
    try{
        //read the message          
        queue.get(theMessage,gmo);  
        //print the text            
        String msgText = theMessage.readString(theMessage.getMessageLength());
        System.out.println("msg text: "+msgText);

                 // <--- Solution code Here

        //move cursor to the next message               
        gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;

    }catch(MQException e){

        if(e.reasonCode == e.MQRC_NO_MSG_AVAILABLE) {
            System.out.println("no more message available or retrived");
        }

        thereAreMessages=false;
    } catch (IOException e) {
        System.out.println("ERROR: "+e.getMessage());
    }
}

Main question: После прочтения строки сообщения и перед перемещением курсора к следующему сообщению, как удалить сообщение из очереди?

Secondary question: Eclispe предупреждает меня, что все участники, использованные для опций, устарели; какие из них правильные?

Solution:

Вот решение, которое я действительно ищу:

// set te cursor to remove the message from the queue
gmo.options = CMQC.MQGMO_MSG_UNDER_CURSOR;
queue.get(theMessage, gmo);

эти строки должны быть вставлены в код вопроса

Я нашел это здесь:http://www.velocityreviews.com/forums/t124676-mq-series-messages-browse-and-delete.html

Ответы на вопрос(2)

Ваш ответ на вопрос