Extend and tune your flow configuration > Post-processing configuration

Post-processing configuration

You can perform post-processing commands on each inbound message immediately after Interchange has consumed, processed and written it to an application delivery. You also can execute post-processing commands after sending messages to partners. Interchange can initiate any executable or batch file or script you specify. The batch file or script is applied to all messages passed through the exchange that calls it. Batch files or scripts can be used with several or all application deliveries or partner deliveries, but they must be called separately. You cannot specify a global batch file or script.

The post-processing script must be on a drive that Interchange can access and has permission to execute.

There are two places in the user interface where you can enter the name of a post-processing script.

When entering the path for a post-processing script in the user interface, we recommend using a relative path rather than an absolute path. Relative paths are preferred if you export partner profiles files for back-up purposes or clone partner profiles in a peer network environment.

Interchange by default passes seven items of message metadata to the post process. Your script can use any or all of them. An example of the syntax of a command that is executed against an inbound message is:

Windows

c:\directoryname\myfile.bat

UNIX

/directoryname/myscript.sh

Post-processing message metadata

The default message metadata for post-processing are described in the following table. These match the default post-processing metadata elements in the shellscriptmetadata.xml file in <install directory>\conf. Interchange checks this file to determine valid metadata for post-processing. The parameter numbers are shown for Windows and UNIX.

Windows

UNIX

Message metadata

Description

%1

$1

SenderRoutingId

The routing ID of the sender of the message.

%2

$2

ReceiverRoutingId

The routing ID of the receiver of the message.

%3

$3

ProductionUrl

The path of the file if the message was written to a File System integration delivery exchange. Otherwise, it is the URL of the destination.

%4

$4

ProductionFilename

The file name used when Interchange wrote the file.

%5

$5

ConsumptionFilename

The file name included in the MIME header, probably the original file name from the sender, if the message was EDIINT. Otherwise, the name of the file as when retrieved from the file system or FTP server.

%6

$6

EdiControlId

The control ID of an EDI message. Otherwise, the ID is XML or BINARY

%7

$7

DocumentClass

The document class of the message payload (for example, X12, XML).

If you are writing a post-processing script in Perl, you cannot use $ in the parameter number. You must use $ARGV[n], where[n] is the argument number. For example, in the preceding table, the parameter for SenderRoutingId is $1; for Perl it is $ARGV0 (notice counting starts at zero). Likewise, the parameter for ReceiverRoutingId is $2, but $ARGV1 for Perl.

Add post-processing elements

You can use other post-processing elements than those listed in the table in Post-processing message metadata. Other metadata elements are documented in Message metadata and attributes.

Add the metadata elements you want to shellscriptmetadata.xml in <install directory>\conf. Follow the format as shown for the default elements already in the file. Pay attention to the order in which the metadata elements are listed. This is important for the corresponding parameter numbers.

After editing shellscriptmetadata.xml, restart Interchange server for the changes to become effective. All post-processing script invocations are affected by changes to this file.

Methods for writing scripts

You can use the following methods for writing post-processing scripts:

Operating system

Languages

Windows

Compiled languages (for example, Java, Visual BASIC, C++, Delphi). Also, .cmd and .bat files.

UNIX

Any language. For example, shell script, Java, C or Perl.

Script example for Windows

The following is an example of a post-processing script for Windows. This script re-directs an inbound file to a local directory and writes activity to an external log file. This example is provided solely to illustrate the correct format for such scripts.

Script example for UNIX

The following is an example of a post-processing script for UNIX. This script re-directs an inbound file to a local directory and writes activity to an external log file. This example is shown solely to illustrate the correct format for such scripts.

Post-processing events

Interchange generates the following events when performing post processing.

See Post-processing configuration.

Post-processing points to consider

Consider the following points when performing post processing:

Related topics