ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » get MQJE001: Completion Code 2, Reason 2024 when processing

Post new topic  Reply to topic
 get MQJE001: Completion Code 2, Reason 2024 when processing « View previous topic :: View next topic » 
Author Message
shavo25
PostPosted: Mon Aug 09, 2010 6:07 pm    Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing Reply with quote

Apprentice

Joined: 16 Feb 2009
Posts: 29

MQ 5.3
JDK 1.6

I incur this problem when im running a java app inside eclipse.
Goal of my app is to read in over 60,000 msgs from one queue, replace a string value in the message and send to another local queue.

My session is transacted and i commit after every send.

This reason code is due to MQRC_SYNCPOINT_LIMIT_REACHED during MQPUT, which means number of uncommitted messages is greater than queue manager property which is 10000.

here is a snippet of my code:

Code:
 /**
     * Consume message, amend and send to queue
     */
    private void  consumeAndAmend(){
        int msgsProcessed = 0;
        try {
            TextMessage newMessage = session.createTextMessage();
                while(true){
                        Message msg = queueReceiver.receive(1000);
                        if(msg != null){
                            if(msg instanceof TextMessage){
                                TextMessage txtMsg = (TextMessage)msg;
                                newMessage.setText(txtMsg.getText().replace("panddArchiveVerifyStep2.V001", "panddArchiveVerifyStep1.V001"));
                                //send message  to queue
                                sendMessage(newMessage, session, queueSender, conn);
                                msgsProcessed++;
                            }
                        }else{
                            break;
                        }
                    else{
                        break;
                    }
                }
        }catch (JMSException e) {
                    log.debug("Exception when sending message "  + e.getMessage());
                    if(e.getLinkedException() != null){
                        log.debug("Linked exception " + e.getLinkedException().getMessage());
                    }
                }finally{
                    // close the queue connection
                    try {
                        if(queueSender != null){
                            queueSender.close();
                        }
                        if(queueReceiver != null){
                            queueReceiver.close();
                        }
                        if(session!= null){
                            session.close();
                        }
                        if(conn != null){
                            conn.close();
                        }
                    } catch (JMSException e) {
                        log.debug("Exception closing connections " + e.getMessage());
                    }
                }
                log.debug("sent " + msgsProcessed + " new messages to queue ");
     }
   
    /**
     * Send message to the new queue
     * @param session
     * @param queueSender
     * @param conn
     * @throws JMSException
     */
    private void sendMessage(Message msg,QueueSession session, QueueSender queueSender, QueueConnection conn) throws JMSException {
        queueSender.send(msg);
        //need to commit session to end transaction
        session.commit();
    }


Can anyone see what is wrong with my code, im committing after every send.

JMS quotes
Quote:
"A transaction is completed using either its session's commit method or its session's rollback method. The completion of a session's current transaction automatically begins the next. The result is that a transacted session always has a current transaction within which its work is done. "


So why is my app falling over!?

Thanks,
Shane.
Back to top
View user's profile Send private message
shavo25
PostPosted: Mon Aug 09, 2010 6:53 pm    Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing Reply with quote

Apprentice

Joined: 16 Feb 2009
Posts: 29

Sorry my fault.

The messages i consume are actually JMSBytyesMessage not TextMessages so i was looping over consuming messages without ever sending so i never committed, hence why i got this exception.

Now i have to try and convert the byte array to string to amend the message before sending, stupid legacy systems!!!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 09, 2010 6:57 pm    Post subject: Re: get MQJE001: Completion Code 2, Reason 2024 when process Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

shavo25 wrote:
Now i have to try and convert the byte array to string to amend the message before sending, stupid legacy systems!!!


No.

You have to perform a typecast.

This is not remotely the same as converting a byte array to a string.
Back to top
View user's profile Send private message
shavo25
PostPosted: Mon Aug 09, 2010 7:55 pm    Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing Reply with quote

Apprentice

Joined: 16 Feb 2009
Posts: 29

yea i jumped the gun there.
What are my options then, the messages have no format, no RFH2 header or MQSTR so i take it i cant cast back to TextMessage can i, to manipulate the body?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Aug 09, 2010 8:14 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

And the code you posted does not show any session.commit() method...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
shavo25
PostPosted: Mon Aug 09, 2010 8:50 pm    Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing Reply with quote

Apprentice

Joined: 16 Feb 2009
Posts: 29

Fixed it, cast to BytesMessage and converted bytes to string to amend the message body.

I commit after every send, look at method again sendMessage

Code:
/**
     * Send message to the new queue
     * @param session
     * @param queueSender
     * @param conn
     * @throws JMSException
     */
    private void sendMessage(Message msg,QueueSession session, QueueSender queueSender, QueueConnection conn) throws JMSException {
        queueSender.send(msg);
        //need to commit session to end transaction
        session.commit();
    }
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 10, 2010 12:28 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

My mistake. Looks like I need more coffee
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Aug 10, 2010 2:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'd thought the only requirement for casting to TextMessage was an MQFMT_STRING.

If the messages contain entirely text data but are being sent with MQFMT_NONE, that's not really correct - and twice as not correct if coming from a mainframe system that almost certainly doesn't use the same CCSID as the systems it is trying to talk to.

j
Back to top
View user's profile Send private message
shavo25
PostPosted: Tue Aug 10, 2010 3:43 pm    Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing Reply with quote

Apprentice

Joined: 16 Feb 2009
Posts: 29

Quote:
My mistake. Looks like I need more coffee

No worries.

Quote:
I'd thought the only requirement for casting to TextMessage was an MQFMT_STRING.


Like i said before the messages had no format so i cast to BytesMessage when i consumed and converted bytes to string to amend the message body detail.

Thanks for your help guys.
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Aug 10, 2010 4:31 pm    Post subject: Re: get MQJE001: Completion Code 2, Reason 2024 when process Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

shavo25 wrote:
This reason code is due to MQRC_SYNCPOINT_LIMIT_REACHED during MQPUT

Run under an MQ trace, it'll tell you what the HConn is being used for.

MQ deals in HConns, not JMS connections, sessions. These are implemented over MQ HConns, and some problems are only solved with this "internal" type of knowledge.

Start with:
strmqtrc -m YOURQMNAME -t api
recreate problem
endmqtrc -m YOURQMNAME

Go to /var/mqm/trace, run dspmqtrc *TRC, and review the .FMT file for the amqrmppa that was serving your app, if it was a client, or the .FMT file for your Java app if it was server bound.

If you're on Windows, it's Program Files\...\trace and no need to run dspmqtrc.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » get MQJE001: Completion Code 2, Reason 2024 when processing
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.