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 » Flow run perfectly in Debug mode not in normal mode

Post new topic  Reply to topic
 Flow run perfectly in Debug mode not in normal mode « View previous topic :: View next topic » 
Author Message
ata_nitjsr
PostPosted: Sun Nov 28, 2010 6:24 am    Post subject: Flow run perfectly in Debug mode not in normal mode Reply with quote

Acolyte

Joined: 08 Apr 2007
Posts: 56

http://www.mqseries.net/phpBB2/viewtopic.php?p=291102#291102

I have created few file by using file output node. After creating the file i try to move from E:\File\mqsitransit to a E:\File for that i have written simple java program in java compute node that will copy the file from E:\File\mqsitransit to E:\File. But problem is the flow runs fine in Debug mode when we run it in normal mode it create a 0kb file in E:\File & the E:\File\mqsitransit file are hold by the dataflowengine


http://d.imagehost.org/view/0685/Flow
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Nov 28, 2010 6:35 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

This is what the Finish File terminal is for and will do.
Back to top
View user's profile Send private message
ata_nitjsr
PostPosted: Sun Nov 28, 2010 6:45 am    Post subject: the code in java compute node Reply with quote

Acolyte

Joined: 08 Apr 2007
Posts: 56

import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.*;
import java.io.*;




public class XML2File_Flow_JavaCompute extends MbJavaComputeNode {



public void evaluate(MbMessageAssembly contact admin) throws MbException{
File s = new File ("E:/File/mqsitransit");
File d = new File ("E:/File");
String separator = System.getProperty("file.separator") ;
int tempCount = 0;
String files[] = null;
try{
files = s.list();
System.out.println("Files1 "+files[0]);
String path = s.getAbsolutePath();
System.out.println("Files2 "+files[1]);

tempCount = files.length;
if(tempCount >0 ){
for(int i=0; i< tempCount; i++ ){
InputStream in = null;
OutputStream out1 = null;
try {
in = new FileInputStream(path+separator+files[i]);
out1 = new FileOutputStream(d.getAbsolutePath()+separator+files[i]);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0){
out1.write(buf, 0, len);
}
out1.close();
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println("Exception - FileNotFound: "+e.getMessage());
}
}
delete(s);
}
}catch(IOException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
}

public static boolean delete(File resource) throws IOException {
if (resource.isDirectory()) {
File[] childFiles = resource.listFiles();
for (File child : childFiles) {
delete(child);
}
}

return resource.delete();
}

}
Back to top
View user's profile Send private message
ata_nitjsr
PostPosted: Sun Nov 28, 2010 6:48 am    Post subject: Reply with quote

Acolyte

Joined: 08 Apr 2007
Posts: 56

mqjeff wrote:
This is what the Finish File terminal is for and will do.


Can you please see the
http://www.mqseries.net/phpBB2/viewtopic.php?p=291199#291199

for the problem
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Nov 28, 2010 7:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What are you trying to do, to move the file from mqsitransit to the final destination, is the job of the Finish File terminal.

The problem you are experiencing is because you aren't calling it for the file in question. The FileOutput node properly keeps it's internal files locked so that other applications can't interfere with it's function and so that other applications know that the file is in use. (which is all well and good if you assume that file locks are reliable, when in fact they aren't).

It is possible that your actual requirement is not something that can be fulfilled using the FileOutput node - for example, if you need to append to an existing file, or perhaps it is not something that can be fulfilled using only ONE FileOutput node.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun Nov 28, 2010 10:54 am    Post subject: Re: Flow run perfectly in Debug mode not in normal mode Reply with quote

Grand High Poobah

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

ata_nitjsr wrote:
I have created few file by using file output node. After creating the file i try to move from E:\File\mqsitransit to a E:\File


You've not created the file if it's still in the mqsitransit directory. The file is still open and still in use by the file output node (as it would be for any applcation writing a file). Until you've got the file output node to close the file for the file you're trying to copy then the file is open and looks like it has 0Kb.

Of course, once you've done this the node moves the file for you. So you're wasting your time.

ata_nitjsr wrote:
But problem is the flow runs fine in Debug mode when we run it in normal mode it create a 0kb file in E:\File & the E:\File\mqsitransit file are hold by the dataflowengine


Because running in Debug mode changes the sequence of some events to allow you to examine things. Like file contents.

The DataFlowEngine is holding the file for the reasons I've explained above. As my most worthy associate points out, you need to finish each file.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun Nov 28, 2010 11:01 am    Post subject: Reply with quote

Grand High Poobah

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

Through both these threads you seem to be determined to use WMB the way you think it ought to work rather than the way it does actually work. While trying to fight the software like this can be fun, it does usuallly end in tears.

Consider other alternatives. As a rule of thumb, if you're writing Java code to do something WMB should be doing for you then you're doing it wrong.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ata_nitjsr
PostPosted: Mon Nov 29, 2010 4:58 am    Post subject: Reply with quote

Acolyte

Joined: 08 Apr 2007
Posts: 56

Problem got solved.... only add a sleep in java code........

Thread.currentThread().sleep(1000);


Thanks for the help & time........
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 29, 2010 6:01 am    Post subject: Reply with quote

Grand High Poobah

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

ata_nitjsr wrote:
Problem got solved.... only add a sleep in java code........


I'm interested to discover that solved this particular problem.

Be sure you're aware of all the implications of making one (or more) of the execution group threads sleep.
_________________
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 » WebSphere Message Broker (ACE) Support » Flow run perfectly in Debug mode not in normal mode
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.