You can perform post-processing commands on each inbound message immediately after Activator has received, processed and written it to an application delivery. You also can execute post-processing commands after sending messages to partners. Activator 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 Activator 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.
Activator 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 |
|
UNIX |
|
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
. Activator 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 Activator 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.
See Post-processing configuration details
You can use other post-processing elements than those listed in the table in Post-processing message metadata.
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 Activator server for the changes to become effective. All post-processing script invocations are affected by changes to this file.
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. |
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.
|
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.
#!/bin/sh
# $Id: UNIXpostprocess.sh to test post-processing.
# This shell script does two things. It moves the received file
# to another directory. Then it appends into a log file all the
# information that CI makes available about that file.
mv "$3"/"$4" /home/cyclone/tmp
echo -----newfile info----- >> /home/cyclone/tmp/postprocess.log
date >> /home/cyclone/tmp/postprocess.log
echo The Sender Routing Id is "$1" >> /home/cyclone/tmp/postprocess.log
echo The Receiver Routing Id is "$2" >> /home/cyclone/tmp/postprocess.log
echo The Production directory is "$3" >> /home/cyclone/tmp/postprocess.log
echo The Production Filename is "$4" >> /home/cyclone/tmp/postprocess.log
echo The Consumption Filename is "$5" >> /home/cyclone/tmp/postprocess.log
echo The Control Id is "$6" >> /home/cyclone/tmp/postprocess.log
echo The Content MIME Type is "$7" >> /home/cyclone/tmp/postprocess.log
|
See Post-processing configuration details.
Activator generates the following events when performing post processing.
See Post-processing configuration details.
Consider the following points when performing post processing: