Using a Custom Process Starter in a Project That Gets Information about a Checking Account

Java Event Source allows you to create a custom process starter written in Java.

Prerequisites

Copy the AccountInformation.txt file from TIBCO_HOME\bw\n.n\samples\palette\java\JavaEventSource to c:\tmp directory on Windows and /tmp on UNIX.

Procedure

  1. In the samples directory, select palette > java > JavaEventSource and double-click tibco.bw.sample.palette.java.JavaEventSource. For more information, see Accessing Samples.
  2. In Project Explorer expand the tibco.bw.sample.palette.java.JavaEventSource 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 PublishAllBalances.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.java.JavaEventSource.application.
  8. Click Debug.
    This runs the sample in Debug mode.
  9. Click the Terminate icon to stop the process.

Result

The process writes the customer last name, account ID, and checking balance to the PublishEvnSourceBalance.log file at c:\tmp\JavaEventSource.

Understanding the Configuration

This sample uses the Java objects such as, LocalBank, Account, Balance, and SystemProperties. The source for these objects is in the src directory.

The process executes as follows:
  1. The Java Event Source activity reads balances from the AccountInformation.txt and outputs an instance of the java.util.LinkedList class that contains a collection of all balances.
  2. The CollectionToArray activity invokes the java.util.LinkedListtoArray method to convert the collection to an array of objects.
  3. The group then iterates over each object in the array.
  4. The Balance activity takes the current object in the array and converts its data to an XML document.
  5. The PublishBalance activity publishes the data from the output of the Balance activity.

Troubleshooting

  • If the Output tab of Java To XML activity is not populated, then press the Reload button next to the Class Name in Java To XML activity.
  • If any problem markers are visible in the project, close and re-open the project or import the project in a clean new workspace.