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 » General Discussion » JAVA IBM MQ Destructive Read Message from Queue

Post new topic  Reply to topic
 JAVA IBM MQ Destructive Read Message from Queue « View previous topic :: View next topic » 
Author Message
venkata.silla4u
PostPosted: Tue May 21, 2019 8:23 pm    Post subject: JAVA IBM MQ Destructive Read Message from Queue Reply with quote

Newbie

Joined: 21 May 2019
Posts: 2

Hi All,

I m trying to read a message from queue and auto delete the message after successfully reading it i.e., destructive read.Some how i tried all the mq options as mentioned below,Though i m able to successful read the message from CICS output queue, i still see a copy of the read message still remains in the queue.which leads to the queue messages pilling up. Need some help if i'm missing anything here on destructive read.

//defining the mq queue object
MQQueue docRespQObj = queueManagerObj.accessQueue(docResQ, CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED);

//Code to read message from queue, descructive read is not working here.
MQMessage messageObj = new MQMessage();
mqGMO = new MQGetMessageOptions();
mqGMO.matchOptions = MQConstants.MQMO_MATCH_CORREL_ID;
mqGMO.options = MQConstants.MQGMO_WAIT;
mqGMO.waitInterval = waitInterval;

// wait interval
messageObj.correlationId = correlationId;

long startTime = System.currentTimeMillis();

docRespQObj.get(messageObj, mqGMO);
int payloadLength = messageObj.getMessageLength();
msgPayload = new byte[payloadLength];
messageObj.readFully(msgPayload);


Please advice if i'm missing any GMO or MQ options.Thank you.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Tue May 21, 2019 10:10 pm    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

If you don't tell MQ z/OS explicitly whether you want sync-point or not then it will assume that you do want sync-point (ie. in a transaction). Unfortunately Distributed MQ went the other way and assumed no sync-point. So, it is always a good idea to be explicit about whether you want transactions involved.

So, I would suggest you add MQGMO_NO_SYNCPOINT to your MQGMO_WAIT get options,

Cheers,

Paul
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
venkata.silla4u
PostPosted: Wed May 22, 2019 3:05 am    Post subject: MQ destructive read/get Reply with quote

Newbie

Joined: 21 May 2019
Posts: 2

I tried adding the No SYNCPOINT here, no luck.. still messages are sitting in the READ Queue which was dropped by the CICS program.

mqGMO.matchOptions = MQConstants.MQMO_MATCH_CORREL_ID;
mqGMO.options = MQConstants.MQGMO_WAIT + MQConstants.MQGMO_NO_SYNCPOINT;
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed May 22, 2019 5:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Use a try / catch block to ensure you're getting any errors MQ is throwing when it tries to commit the read.

It's best practice anyway; your code may be solid but any number of external factors can cause problems.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » General Discussion » JAVA IBM MQ Destructive Read Message from Queue
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.