Managed File Transfer Capabilities in the WebLogic Platform
File Handling Automation
In the previous section, we looked at how trading partners can securely transfer files to a folder in the OMS of GlobalTx. This section focuses on how the processing of these files can be automated. WebLogic Platform supports the following two mechanisms for automating file handling, namely event handling and scheduling.
Event handling consists of initiating a particular action at the occurrence of a particular system event. In the case of GlobalTx, the arrival of the FIX file containing orders to a folder becomes the system event that triggers further processing. WebLogic Platform provides file event generators that can be used for such purposes. We can set up the file event generator in the OMS of GlobalTx to poll for the arrival of files in the folder and raise a corresponding file event, as displayed in Figure 4.
Figure 4. Event handling and scheduling
After getting triggered, the file event generator can be configured to publish the contents (or a reference to the folder location) to Message Broker channels as binary objects or XML. In this case, we publish an XML message containing details of the file location to the Message Broker channel, so a file control can subsequently process the file. A file event generator can be configured in a few simple steps as described here. It provides a lot of flexibility by allowing for the definition of channel rules that range from specifying the polling interval, the file location to poll (as local directory or a remote FTP server), and the file matching patterns to performing post-read action and file archiving.
Scheduling is closely related to event handling. Scheduling support provides considerable added value to a file transfer implementation. With scheduling facilities, it is possible to periodically trigger the processing of files at particular points in time. Instead of inducing the processing of files at arrival, we can schedule GlobalTx's OMS to pick up files for processing after every hour or so, as depicted in Figure 4. Once this is set up it is not necessary for someone to remember this needs to be done and then issue the command to perform the activity.
WebLogic Platform provides a timer service that can be used along with file control to support processing of files scheduled for transfer at periodic intervals. The timer service is available in the form of a timer event generator and creates events at user designated times. When the timer event generator detects that a designated time has passed, it publishes a message to a Message Broker channel. The steps for creating a timer event generator are similar to those for creating file event generators; the main difference is in the channel rules that can be defined. More information on the various options for defining channel rules for timer event generators is available here. Once the event generator is configured with a Message Broker channel, we can define a business process that subscribes to events on this channel. Figure 5 shows how the business process called LocalFileValidationProcess can be made to subscribe to the Message Broker channel associated with the timer event called /sftpPrefix/sftp/sftpTimerChannel.
Figure 5. Subscribing to a Message Broker channel
Using the information obtained from this channel, the business process can now employ a file control to process the files as required. For details on how to define and use file controls refer to the documentation.
If file transfer is to be used as a method of integration as in the case of GlobalTx, it is critical that information presented to the target system is in a format the system is designed to process. As the trading partners would be sending files encoded as per the FIX specification, GlobalTx's OMS would need to have a transformation engine to transform the orders to a form that is necessary for further processing. As Figure 4 shows, this engine can be invoked on receiving messages published in the Message Broker channel, by either one of the mechanisms of automating file handling that we discussed in the previous section. This operation is important because in the future new trading partners could potentially use different formats as a consequence of having completely different IT systems and applications. Therefore, modern file transfer needs transformation capabilities that make it possible for the information to be "massaged" before delivery, or alternatively, before receipt, as shown in Figure 6. This transformation should be done using easy-to-use tools to effect a seamless and efficient file transfer.
Figure 6. Message transformation on file transfer
WebLogic Platform addresses this need with the easy-to-use Format Builder tool. For more details on how to use Format Builder effectively to define MFL definitions, refer to the Workshop documentation. We can use this tool for defining the message transformation rules for FIX files sent by trading partners to the standard XML format understood by GlobalTx's OMS. This is accomplished by using delimiters to indicate the message structure and mapping this data to nodes of the required output XML format. You can immediately validate the mapping defined using the Format Tester utility that comes with the Format Builder tool. Figure 7 depicts how the Format Tester converts non-XML file messages to the corresponding XML representation as defined in the Format Builder.
Figure 7. Using the Format Tester for validating message transformation
Once mapped these definitions are stored in a MFL (Message Formatting Language) file. MFL files are very similar to XML schemas (XSD); the only difference is that they define custom formats rather than XML formats as defined by XSDs. WebLogic Integration transforms the raw data input, complying with an MFL definition, and maps it to Java objects as determined by the message-based application. Figure 8 displays how the non-XML raw data gets mapped to a JavaBeans object created from the MFL definition.
Figure 8. Mapping non-XML data to a JavaBeans object
The code fragment generated for the above mapping is shown below:
public void clientRequest(com.bea.data.RawData x0) throws Exception //#START: CODE GENERATED - PROTECTED SECTION - // You can safely add code above this comment in this method. // input transform parameter assignment this.fixObj = fix.FIXMLMflObject.newInstance(x0); //#END: CODE GENERATED - PROTECTED SECTION - // You can safely add code below this comment in this method. #//
The above example shows how file transformation from a non-XML format is made into a trivial task using WebLogic Platform tools.