|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
File stranded in mqsitransit when using TimeOutNotification |
« View previous topic :: View next topic » |
Author |
Message
|
mhd.zabiullah |
Posted: Wed May 01, 2013 8:07 am Post subject: File stranded in mqsitransit when using TimeOutNotification |
|
|
Newbie
Joined: 11 Apr 2011 Posts: 6
|
Hi All,
I am using WMB 6.1 with MQ 6.0. We have a flow which implements batch processing. It takes messages from a queue and appends these messages to a file at the output using FileOutput node. The filename of this file is generated using a value in a database table. A time node is used to generate a timeout at 2 minutes interval. once the Timer node sends a timeout notification, a message is sent to the Finish File terminal of the FileOutput node to complete the file. At the same time the value in the database is incremented by 1 so that the next file has a different file name. This works quite well. However sometimes when there are large amount of messages, the file gets completed, but another file with the same file name gets stranded in the mqsitransit directory. This file will have only one record. The value in the database would have been incremented by 1 in that time, so this file will never get completed.
Can someone shed some light as to why this is happening.
Thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Wed May 01, 2013 9:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
TimeoutNotification node starts a separate instance of the flow.
You should use it to set a SHARED variable inside an ATOMIC block, and do all of the rest of the work (finishing the file, updating the database row) as part of another ATOMIC block while processing records in the flow read from the queue. |
|
Back to top |
|
 |
mhd.zabiullah |
Posted: Wed May 01, 2013 11:40 am Post subject: |
|
|
Newbie
Joined: 11 Apr 2011 Posts: 6
|
Thanks mqjeff. I was thinking along the same lines that a separate thread would be created.
I had also tried using a shared variable, but problem with shared variable is that it gets reset if the flow or EG is restarted, in which case my previous batch would again get stranded.
One doubt that i have is, currently i am using a select statement to fetch the batch number from the DB in the first part where i am writing the records to the file and use this batch number to set the file name. I am using another Select in the 2nd part after the timeout notification where i am using the batch number from the DB to complete the file and an update to the DB to increment this batch number. My question is, if i put the 1st select and the 2nd select and update in an atomic block will that help me? because from what i know atomic is for single access for a single thread, whereas my 1st and 2nd selects are in 2 separate part of code, so they can still run in parallel. |
|
Back to top |
|
 |
zpat |
Posted: Wed May 01, 2013 11:38 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Why not use the MQGET node wait interval time to end the batch? So if no messages have arrived in, say 5 minutes, the "no msg available" terminal can drive the file finish.
This is done by using the MQINPUT node to get the first message in a batch and using the MQGET node (driven by a compute node propagate loop) to get the others.
Alternatively consider use of MQ grouping and select the "all messages available" option in MQINPUT node, then it will process only when the group of messages is complete on the queue.
Using an indirect means of achieving a similar result outside of MQ is just asking for trouble (and you found it!). |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|