Creating an Order Processing Service

This sample describes a simple order processing service where a File Poller activity waits for the BW_new_order.xml file to be updated. After an update is detected, the process creates an empty approval file and calls a sub process to calculate the shipping costs. The process then waits for the empty approval file to be updated. Finally, the BW_customer_notification.txt file with data in XML format is created in the c:\tmp\OrderProcessing folder of the default location, or the path you specified earlier that gives the customer the relevant shipping information.

In a real system, tasks such as database queries, email acknowledgment, and so on would be used to implement this scenario. However, we have chosen to use files for this service to highlight the use of the activities in the file palette.



Note: If you are accessing the sample from the Welcome page of TIBCO Business Studio™ for BusinessWorks™, go directly to Step 3.

Procedure

  1. In the samples directory, select palette > file > OrderProcessing and double-click tibco.bw.sample.palette.file.orderprocessing. For more information, see Accessing Samples.
  2. In the Project Explorerview, expand the tibco.bw.sample.palette.file.orderprocessing project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Fully expand the Processes directory and double-click ProcessOrder.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  7. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco.bw.sample.palette.file.orderprocessing.application.
  8. Click Debug.
    This runs the sample in Debug mode.
  9. Click the Terminate icon to stop the process.

Result

The waitNotify.log output file at C:\tmp\WaitNotify should have the following content:

The BW_approve_order.txt file is deleted.

Understanding the Configuration

The following file names are defined as Module Properties and can be changed in the Module Properties dialog.
  • BW_new_order.xml points to the XML file that contains the new order details and triggers the process initially as Include Existing Files check box option is selected. For consecutive triggers, the file must be updated (overwritten or modified) each time for the sample process to run or the process does not start.
  • BW_shipping_costs.xml contains shipping cost information.
  • BW_customer_notification.txt is created by the process to notify the customer of the complete shipping details.
  • BW_approve_order.txt is created by the process. The file is deleted during process execution.