Author |
Message
|
shavo25 |
Posted: Mon Aug 09, 2010 6:07 pm Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing |
|
|
 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 |
|
 |
shavo25 |
Posted: Mon Aug 09, 2010 6:53 pm Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing |
|
|
 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 |
|
 |
mqjeff |
Posted: Mon Aug 09, 2010 6:57 pm Post subject: Re: get MQJE001: Completion Code 2, Reason 2024 when process |
|
|
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 |
|
 |
shavo25 |
Posted: Mon Aug 09, 2010 7:55 pm Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing |
|
|
 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 |
|
 |
fjb_saper |
Posted: Mon Aug 09, 2010 8:14 pm Post subject: |
|
|
 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 |
|
 |
shavo25 |
Posted: Mon Aug 09, 2010 8:50 pm Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing |
|
|
 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 |
|
 |
fjb_saper |
Posted: Tue Aug 10, 2010 12:28 am Post subject: |
|
|
 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 |
|
 |
mqjeff |
Posted: Tue Aug 10, 2010 2:01 am Post subject: |
|
|
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 |
|
 |
shavo25 |
Posted: Tue Aug 10, 2010 3:43 pm Post subject: get MQJE001: Completion Code 2, Reason 2024 when processing |
|
|
 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 |
|
 |
mvic |
Posted: Tue Aug 10, 2010 4:31 pm Post subject: Re: get MQJE001: Completion Code 2, Reason 2024 when process |
|
|
 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 |
|
 |
|