Author |
Message
|
riyaz_tak |
Posted: Thu Jan 24, 2019 9:23 am Post subject: Issue when messgae is fetched but error occur |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
Hi
IBM MQ version 7.5
OS Solaris 10
We have client program which reads the message from Local queues and pass them to other components.
My question is what happens when we have fetched the message but failed to pass to other component (because of some issue).
What happens to message in this case ? Is it lost ? How can we avoid or handle such scenario? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 24, 2019 9:29 am Post subject: Re: Issue when messgae is fetched but error occur |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
riyaz_tak wrote: |
What happens to message in this case ? Is it lost ? |
Depends entirely on how your application is coded. If you've explicitly or implicitly committed the read of the message, then the message is lost because your application has no copy of it (because of the issue) and you told MQ it was ok to delete the message because you'd finished processing it. If not, then the message will roll back onto the queue.
riyaz_tak wrote: |
How can we avoid or handle such scenario? |
Make sure the message read and the sending to the other component (it's not clear if you mean sent by MQ or some other method and it really makes no difference) are in the same unit of work and you don't commit the read until the send succeeds. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 24, 2019 9:39 am Post subject: Re: Issue when messgae is fetched but error occur |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Vitor wrote: |
Depends entirely on how your application is coded. |
Each MQ API call returns to the application a ReasonCode that explains success or failure of the call. If there is a database involved, it will return to the app the same kind of information.
The app is responsible for recognizing the success or failure, and to take appropriate action (commit or backout) the work in progress. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
hughson |
Posted: Thu Jan 24, 2019 1:20 pm Post subject: Re: Issue when messgae is fetched but error occur |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
riyaz_tak wrote: |
We have client program which reads the message from Local queues and pass them to other components.
My question is what happens when we have fetched the message but failed to pass to other component (because of some issue).
What happens to message in this case ? Is it lost ? How can we avoid or handle such scenario? |
Simplest way would be to ensure that the message is read by the client program from the local queue using a transaction, e.g. MQGMO_SYNCPOINT, and then if there is a failure, rollback the transaction, e.g. MQBACK, and then the message will be there to read again.
You don't say what language your client program is written in so I have not provided code examples. If you want to show us your code, we could advise where to make changes.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
riyaz_tak |
Posted: Thu Jan 24, 2019 2:23 pm Post subject: |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
Thanks everyone.
Mq client is written in Java 8. |
|
Back to top |
|
 |
hughson |
Posted: Thu Jan 24, 2019 3:22 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
Glad you're all sorted.
Please feel free to ask any further questions if you have them.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 24, 2019 3:25 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Good idea to review error logs. Both MQ on client platform and server platform have error log directories with error log files in them. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
riyaz_tak |
Posted: Thu Jan 24, 2019 4:25 pm Post subject: |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
hughson wrote: |
Glad you're all sorted.
Please feel free to ask any further questions if you have them.
Cheers,
Morag |
It's not sorted yet.i need to try this thing tomorrow. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 24, 2019 4:44 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Is this a new problem? If so, what has changed since it last worked successfully? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
hughson |
Posted: Thu Jan 24, 2019 9:07 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
riyaz_tak wrote: |
hughson wrote: |
Glad you're all sorted.
Please feel free to ask any further questions if you have them.
Cheers,
Morag |
It's not sorted yet.i need to try this thing tomorrow. |
Ok, well, if you need further help, please give a few more details once you have tried it tomorrow.
All the best,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
riyaz_tak |
Posted: Fri Jan 25, 2019 10:01 am Post subject: |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
It worked like a charm.
Thanks everyone |
|
Back to top |
|
 |
hughson |
Posted: Fri Jan 25, 2019 1:19 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
|
Back to top |
|
 |
|