Exercise 2.4 – Creating and Using Custom Attributes
Purpose:
To practice creating custom Transaction Attributes and using them with OGNL in the eiConsole.
Create a Route
- From the eiConsole File Management screen, select the Add Route button.
- In the dialog that appears, enter the name Custom Attributes and select OK.
- The Route should now appear in the table on the screen. Double-click it to open it.
Document the Source System
- Select the Source System stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Change the System Name to XML File.
- Select the Choose Source Icon button, and scroll down to select one of the XML icons.
Set the Transaction Attribute with a Processor
- Select the Processor Configuration tab, next to the already selected Listener Configuration tab.
- Click the Add Processor button in the new configuration panel. The Add Processor dialog will appear.
- Select the Transaction Attribute Population Processor from the Processor Type selection box. Optionally, click the … button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
- In the Transaction Attribute Name field, write output.file.name.
- In the Evaluate Expression field, write attribute-output.
Initial Transport Configuration
- Select the Transport stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Select Directory/File from the Transport Type selection box. Optionally, click the … button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
- Select the Target Directory, using the … button to open the file selector.
- Set xml as the Target File Extension.
Configure Transport Target File Name with OGNL Expression
- For the Target File Name, choose the button on the very far right of the field to open the Enhanced Settings panel. New buttons and a new text field should appear.
- Of the new buttons, one of them has an icon with two overlapping circles on it. This is the OGNL Expression button. Select it to open the OGNL Expression Constructor.
- In the ONGL Expression Constructor, scroll down the top panel list to find the getAttribute(‘INSERT_ATTR_NAME’) item. Select it, and click the Insert button on the far right.
- The selected expression is now populated in the text field at the bottom of the dialog.
- Select the INSERT_ATTR_NAME portion of the expression, and delete it. Make sure the opening and closing ‘ (quotes) are still present.
- Write output.file.name in the spot where the deleted text once was. The new expression should now read: getAttribute(‘output.file.name’).
- Select the OK button at the bottom of the dialog. The Target File Name field should now be populated with the OGNL Expression.
Document the Target System
- Select the Target System stage in the Route Editing Grid. The configuration panel will appear at the bottom.
- Change the System Name to XML File.
- Select the Choose Target Icon button, and scroll down to select one of the XML icons.
Prepare to Test
- In the menu bar at the top, select Route -> Testing Mode. Make sure the changes to the Route are saved.
- Copy the file called people.xml from the Samples directory provided into the directory chosen as the polling directory.
Perform the Test
- At the top of the Testing Mode screen, select the Execute Test button.
- If the Route was configured successfully, all the Stages should light up with green checkmarks.
- In the OS File Explorer, open the directory selected as the Target Directory. The file attribute-output.xml should be there, with contents identical to the people.xml input file.
Output Files
- Compare the results from the exercise with the following example output files to see if they are correct.