Tutorial & Interface
eiConsole Tutorial Basic
Using Environment Properties
In this tutorial, we’ll cover the uses of environment properties, how to configure them, as well as what they’re for. In addition, this tutorial expands on eiConsole basics, such as configuring Listeners and Transports and testing.
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.
Most modules in the eiConsole, such as Listeners, Processors, Transports, and so forth, make use of configuration items, which so far we’ve largely configured as static, constant values. For example, we’ll use a Directory/File Listener’s configuration:
In this case, we’ve typed (or browsed to) the value for the “Polling Directory” item. It’s currently set to “C:\in.” We’ve also set the “Polling Interval” to check the specified directory for new files every five seconds. This approach has been quite workable for building our Interfaces and testing them. However, suppose that we need to move this interface from our workstation to another or, more importantly, to a testing or development environment. As is, we’d need to load up the Route in an eiConsole on that machine and make the appropriate changes. Then, when we move the interface from the testing machine to a staging environment or even to production, we would once again need to edit the Route.
Now, suppose our interface is made up of many Routes, each with multiple Listeners and Transports. Some might be interacting with folders, meaning we’d need to change the paths each time. Others might be querying and updating databases, meaning we’d need to change connectivity information, including usernames, passwords, connection strings, driver names, etc., each time. The problem of moving interfaces from environment to environment quickly scales up as the complexity of an interface grows.
Fortunately, there’s a pretty simple, straightforward solution: environment properties. Environment properties are property values defined in an external file that exists, relative to an interface, at a fixed location (the root directory). We can edit and use the contents of this file from within the eiConsole by going to the Edit menu and selecting “Environment Properties”:
This will open the Environment Properties dialog.
Defining Our Source Directory and Polling Interval
Here we have the contents of the environment properties file shown in a table. The “key” is the name of the property and the “value” is its current value. Let’s try defining our source directory and polling interval here by adding two rows: the first key is source_directory, and its value is C:\in; the second key is polling_interval, and its value is 5.
We could add as many such keys and values as we wished, so long as each key has a unique name. It’s generally a good idea to qualify keys by intent or through some namespace. We can then click the “Save” button to save our changes:
After saving, click “Close” to close the dialog. Returning to our Directory/File Listener’s configuration, we’ll note a button visible to the right of each configuration item.
This button enables “enhanced configuration values,” meaning it provides access to various dynamically evaluated expressions, including our defined environment properties. Click the button and it should be replaced by three more.
The first button allows us to select from defined environment properties. The second will enable us to construct OGNL expressions (covered in another tutorial). Finally, the third returns us to “standard” configuration values. Click the first button and it will open a dialog showing our defined properties:
For this item, we’ll select “source_directory.” Select it in the table, then click the “Select” button:
Our configuration item’s value now looks like this:
The “$$source_directory” part tells us that we’re looking for an environment property named “source_directory.” The “=C:\in” simply tells us the current value of that property, as understood by the eiConsole.
Repeat the exercise for the Polling Interval item:
Now, whenever we move this Route between systems, we can either make our changes in the eiConsole Environment Properties dialog or edit the file directly. If we examine our working directory, we’ll see it now looks like this:
We now have a file called “environment-settings.conf” – this is the external file. You can open it in any standard text editor; do so:
When we move our interface between systems, we only need to update this single file. If the interface exists already on a particular system then our deployment is simply a matter of not copying over it.
Using Environment Properties in the eiConsole module configuration items allows for externally defined values for Listeners, Transports which you can now use. Next, move on to more advanced topics like Expressions – Using OGNL.