Tutorial & Interface
eiConsole Tutorial Basic
Configuration Using Transaction Attributes
This Interface demonstrates how the eiConsole utilizes Transaction Attributes to dynamically set configuration values for modules. Transaction Attribute based Configuration may be used when:
- A file being written needs to use the same filename as a file that was read (Example)
- A file being written needs to use a complex filename based on the data
- An HTTP Post transaction needs to write to different URLs depending on the incoming data
- An email needs to be written to different Targets depending on the incoming data
- A database Transport needs to change username and password and/or Target database dep. on data
How to Run This Example
You must run this from the Listener by configuring the attached environmental properties file; any input file will work. It must be run for the Listener to avoid an error, as the Transport depends upon transaction attributes created by the Directory Listener.
The incoming transaction will be written to disk, using the incoming filename and extension to determine the filename.
How to Use This Example
Download the INTERFACE file and save it to your local disk.
Open the eiConsole, click on the File drop-down menu and select Import Working Directory/Route/Format. Highlight the name of the file to import and press the Import Selected button. The imported Interface will appear in your current Working Directory.
Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route (Sample Data).
Open the Main Route Grid for the Sample Interface
This interface has two functioning pieces; the Listener and the Transport.
The Listener polls a directory set by a configuration value stored in the environment properties file (included with this interface) every five seconds. The sample file intended to be used with this interface is provided alongside this instructional guide; it is Sample2.xml.
The pre-defined polling directory is C:\Test\Directory\In. If it doesn’t exist on your local machine, you can create it or change the Polling directory for the desired one.
The directory transport configuration doesn’t look too remarkable from this view; click on the eye icon to the right of the configured file name:
You will see what it is doing.
Looks a little more interesting here, right? If you did the previous tutorial, you’d recognize this as our OGNL Expression Constructor, our tool for building OGNL expressions. This configuration concatenates the file extension with the file name – “Sample2.xml” will be written as “Sample2xml”. This was intentional. You can try to use this expression:
getAttribute('com.pilotfish.FileName') + getAttribute('com.pilotfish.FileExtension')
Any Java function may be used here, as well as string concatenation; this particular output configuration, for example, lacks a period between the file name and file extension. It’s relatively simple to add this; the configuration becomes:
getAttribute('com.pilotfish.FileName') + '.' + getAttribute('com.pilotfish.FileExtension')
And the example interface will generate “Sample2.xml”. Or you can get the same result by moving the second getAttribute to the file extension configuration – Target file extension.
The prepopulated transaction attributes are simply those attributes that the eiConsole expects to be available; if you’ve created your own attributes which don’t show up, it’s relatively easy to use them here. Simply write “getAttribute(‘[attribute name]’), as seen here.
This concludes the demonstration of using attributes in complex configurations.