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 » WebSphere Message Broker (ACE) Support » Transaction property for FileOutput node

Post new topic  Reply to topic
 Transaction property for FileOutput node « View previous topic :: View next topic » 
Author Message
ghoshly
PostPosted: Thu Jun 03, 2010 3:16 am    Post subject: Transaction property for FileOutput node Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

I need to maintain transactional boundary in a scenario where I need to read a message from MQ queue and based on that I need to put multiple output files in multiple directory.

So simple flow of MQInput --> Compute --> FileOutput

The whole output file is the content for one file, so using " Record is Whole File " option, which has no effect on the Finish terminal msg.

Now, I need to maintain ALL or None scenario for all the output files, but even if the Transaction mode is set to 'yes' in the MQInput node, that is not maintained for output files, and in case of any error output files are not rolled back.

Please help me how I can design and implement this.

Thanks in Advance...
Back to top
View user's profile Send private message
ghoshly
PostPosted: Thu Jun 03, 2010 3:18 am    Post subject: Environment : Broker Version Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

Sorry, forget to mention the broker version and environment set up.

Broker 6.1.0.4
Windows and AIX
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jun 03, 2010 4:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The documentation on the FileInput and FileOutput nodes are extremely clear that they are NOT transactional.

This is because FILES are not transactional.
Back to top
View user's profile Send private message
ghoshly
PostPosted: Fri Jun 04, 2010 1:41 am    Post subject: Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

Yes, now I understand that, sorry, but in order to achieve the functionality is there any way where I can still keep lock on the output files through the FileOutput node and release them for other applications only when all are available ?

Or else my thinking process :

MQInput --> Transform_Compute --> PutFile_JCN --> Other_Func

PutFile_JCN :

try {
1) Would put files in the directory with an exclusive lock on the file (FileChannel.tryLock)

2) Update the List in Environment and increase the fileCount .
}
catch {
for all previous put success in try block ( a. Unlock the file.
b. Delete the file.
)
}
finally {
It would release lock when all the files are fine. i.e count reaches max file count.
}

My concern is it possible that the application which is reading the output directory, can read the file between Step a and Step b
when file lock is released but is not removed yet.

Thanks for help..
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 04, 2010 1:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

ghoshly wrote:
Yes, now I understand that, sorry, but in order to achieve the functionality is there any way where I can still keep lock on the output files through the FileOutput node and release them for other applications only when all are available ?


Generally, no.

Generally, this is a significantly more complicated scenario than it sounds like on first draft.

You should ideally convert the receiving application to use MQ and then use a Message Group to hold the "files".

Otherwise you need to do something to take an action when your flow knows that all files are done. I suppose one POSSIBLE way to do this is to NOT use Record is Whole File, and use the Finish File terminal. Once you know that you've written out the data portion to all files (but they aren't finished) then you can do a quick loop to finish all files.

But this is still fraught with error cases and very likely to fail silently - like any solution for the general problem of "I need X files to be available as an atomic unit".
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Jun 04, 2010 2:00 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

mqjeff wrote:
Otherwise you need to do something to take an action when your flow knows that all files are done. I suppose one POSSIBLE way to do this is to NOT use Record is Whole File, and use the Finish File terminal. Once you know that you've written out the data portion to all files (but they aren't finished) then you can do a quick loop to finish all files.

But this is still fraught with error cases and very likely to fail silently - like any solution for the general problem of "I need X files to be available as an atomic unit".


Absolutely concur.

Maybe you could write your files to a temporary directory and then use the Finish File terminal to kick off a process to move them.

I'd also suggest having some sort of file header and trailer records so that if other applications do happen to pick up incomplete files, they'll recognise them as such due to missing trailers, or mismatched record counts.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
ghoshly
PostPosted: Sun Jun 06, 2010 11:27 pm    Post subject: Possible way Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

thanks a lot, I have implemented the possible way mqjeff suggested. Can we take any precautionary cover for the possible silent failure ?
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 » WebSphere Message Broker (ACE) Support » Transaction property for FileOutput node
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.