cancel
Showing results for 
Search instead for 
Did you mean: 

Import Server Query

Former Member
0 Kudos

Hi All,

If we use Import Server on the Port of a repository, we need to specify a map that can be run on the Port in Console.

But can I run multiple maps on the same file using the Import Server? If yes, how can it be done?

How can we raise an event whenever a file is dumped into a directory? I am using Import Manager batch and I want to schedule the batch process whenever a file gets dumped to a particular folder.

Thanks in advance.

Pooja.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Subbu,

Thanks for providing me the code. But I am still facing a problem. I have modified my code as below -

import java.io.File;

import java.lang.*;

public class DirMonitor

{

static final String DIR_PATH = "<Valid path>";

static final int PING_PERIOD = 3000;

public static void main(String[] args) throws Exception

{

File dir = new File(DIR_PATH);

while (true)

{

String[] filelist = dir.list();

if(filelist!=null)

{

System.out.println("No.of Files found are:" + filelist.length);

Runtime rt = Runtime.getRuntime();

Process p = rt.exec("<Complete path to the batch file>");

System.out.println("Check");

p.waitFor();

System.out.println("Next Check");

}

try

{

System.out.println("Waiting.....");

Thread.sleep(PING_PERIOD);

System.out.println("Waiting Complete...");

}

catch (Exception e) {}

}

}

}

As soon as I am running this program, It runs well till System.out.println("Check");.

But it stops to process further on "p.waitFor()" statement.

Looks like the process does not terminate. I don't know why?

I doubt wheteher the batch file is running or not, as I don't see the batch file running on the command prompt.

Note: My batch file is running fine when I am trying to run it manually.

Can you please suggest what could be the problem?

Regards,

Pooja

Former Member
0 Kudos

Hi Pooja and Rajani,

Could you not set up the Import Server on automatic start and give it a time interval so that it checks the ready folder every 5 minutes, lte us say, and processes the files that are out there?

I tested this when I prototyped the import server, and it works fine.

If you want to use IMB, then is there a special ini file configuration where you can give the file type of port, and the file location? Once that is done, all you need to do it create a .bat file with IMB command or commands and schedule it to run as often as you expect the file to be ready...

Of course, java program is an option!

Savi

Former Member
0 Kudos

Hi Pooja,

When you have multiple import maps need to be used during an automated import process, to my knowledge you can <b>only</b> use the Import Manager Batch.

As Rajani/Savi said, you can have all the configurations in a configuration file and in the .bat file use the IimportManagerBatch process command and parameters.

Use the OS Scheduling job to execute the .bat file at specific intervals.

For scheduling task at OS Level got Control Panel->Scheduled Task and follow the instructions.

Regarding the <b>"Only"</b>.

For every port you define in MDM Console at the repository level, specific directory sturcture is created in the MDM Installation directory.

<Sever Installation irectory>

->\Distributions\

--><ServerName>_<DBMS Type>

--->\<RepositoryName>

-


>\Inbound\

-


><ClientSystem_Code>

-


>\<PortId_one>

Archive

Ready

Log

Status directories are created.

Lets say I have 6 ports and need to be executed in specific order.

So I will have 6 folders with name as <Port Id> and under that I will have the "Archive","Ready","Log" and "Status" directories.

Let say all the maps uses the same source file. So you copied the file into all the "Ready" folders in each portid directory.

But in the mdis.ini file, we can have interval settings at Global level.

I doubt which file in which "Ready" folder the Import Server will pick up and start the import process?

Thanks and Regards

Subbu

Former Member
0 Kudos

Hi Rajani/Savi/Subbu,

Creating multiple ports to run multiple maps, doesn't seems to be a feasible option. In my case I need to run 10+ maps on a single file.

Is there any other way apart from Import Manager Batch? If we need to use the IMB, can anyone provide me a sample JAVA snippet for triggering the batch everytime as soon as a file is placed in the Port's Ready folder.

Regards,

Pooja

Former Member
0 Kudos

Hi,


import java.io.File;
class DirMonitor 
{
	static final String DIR_PATH = <DirectoryName>;
	static final int PING_PERIOD = 3000;
	public static void main(String[] args) throws Exception
	{
	    File dir = new File(DIR_PATH);
		while (true) 
		{
			String[] filelist = dir.list();
			if(filelist!=null)
			{

				System.out.println("No.of Files found are:" + filelist.length);
				Runtime rt = Runtime.getRuntime();
				Process p = rt.exec("T.bat");
				p.waitFor();
			
			}
			try 
			{   
				System.out.println("Waiting.....");
				Thread.sleep(PING_PERIOD);
				System.out.println("Waiting Complete...");
			}
			catch (Exception e) {}
		}
    }
}

This is a sample snippet, you may have to modify according to your requirement.

Thanks and Regards

Subbu

Former Member
0 Kudos

Pooja,

You are right, one port can be configured with one map. If you want to use the same file for two ports, you need to copy the file into both the "Ready" folders of those two ports.

Regarding Import Manager Batch, my suggetion would be to create a simple Java program which will trigger the Import Manager Batch once the file is placed in the appropriate folder. In this case, the event raising must be handled in Java. I am not sure if any event is raised at OS level whenever a file is placed in a specific folder and if it works, this also is a nice option.

Hope this helps,

Regards,

Rajani Kumar