Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

Question

...

Is there any way to set multiple destinations/targets in JADE?

Answer

...

Within limits. JADE is presently not able to work as an Enterprise Service Bus (ESB). But multiple targets and sources, like an ESB, are on the wish lists of some users. The idea is to get the data from a source (or multiple sources) and transfer them to e.g. an ftp-FTP server, a smtp-an SMTP server and to an archive folder on the ftp-a different FTP server. This will require a " new " kind of configuration and the ini-file approach currently used in JADE is not very helpful for this kind of customising. We will be changing to a xml -file structure configuration files in the future.

Transfer to different destinations on the same server

You can, however, copy or move files to different destinations on the same server. For example, if you want to copy a file after transfer to an additional folder then you can use the Postpost_Commandcommand and Prepre_Commandcommand parameters. These parameters are available for the source and the target. The command string, defined there, will be executed for each transferred file.

An example for Linux

...

in Java:

Code Block
languagejava

 objOptions.Target().Post_Command.Value("echo 'File: $TargetFileName' >> t.1;cat $TargetFileName >> t.1;rm -f $TargetFileName");
 objOptions.Target().Pre_Command.Value("touch $TargetFileName");

The Post_Command will do  is used in order to execute a command string which that will:

  1. append the text "File: ..." to a file named t.1
  2. append the content of the current targetfile target file to the t.1 file
  3. remove the current targetfiletarget file

"$TargetFileName" is  is a variable name (place holder) for the current target file. "$SourceFileName" is  is the name of the file from the source which that is currently transferred.

...

More examples:

After transfer of a source file the source file should be moved to an archive folder:

Code Block

 source_PostCommand=mv $SourceFileName  ...

Another way to rename/move (but not copy) on source and/or target is to use the replace and replacing parameters:

Code Block
languagejava

 objOptions.Source().replacing.Value("(.*)(.txt)");
 objOptions.Source().replacement.Value("/SAVE/\\1_[date:yyyyMMddHHmm];\\2");

or in INI ini-file notation:

Code Block

 Source_replacing=(.*)(.txt)
 Source_replacement=/SAVE/\1_[date:yyyyMMddHHmm];\2

All Files files on source with .txt extension will be moved to the /SAVE/ folder  folder and the filename will be extended by a timestamp.

Using JADE this way you can move or copy files in the source or target folder to any other destination that can be accessed from JADE.