Using a Cross Process Conversation to Determine the Mortgage Rate

The process conversation mechanism is demonstrated using a mortgage rate calculation scenario that performs the following:

  • A user passes the customer's name and credit profile information.
  • If the credit profile value of the customer is A, the mortgage lending rate is 3.5 and if the credit profile is B, the lending rate is 2.0.
  • Depending on the mortgage lending rate calculated, the lending institution decides either to accept or to reject the application. This particular lender decides to lend money only with the 3.5 mortgage rate. If the calculated rate is lower for any credit profile, the application is rejected by the lender.

Procedure

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

Result

The CrossProcessConversation.log output file at C:\tmp\CrossProcessConversation is created with the following content:

Received application from BWUser user with credit profile B

Mortgage Cancelled

### DONE

The console displays the following log message:

12:20:42.735 INFO [bwEngThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.c.c.C.SubmitMortgageAppLog - Received application from BWUser user with credit profile B

12:20:42.779 INFO [bwEngThread:In-Memory STWorkProcessor-4] c.t.b.p.g.L.t.b.s.c.c.C.CancelMortgageAppLog - Mortgage Cancelled

12:20:42.818 INFO [bwEngThread:In-Memory STWorkProcessor-5] c.t.b.p.g.L.t.b.s.c.c.C.Log - DONE

Understanding the Configuration

Operations implemented in the Service Provider process are invoked from the Consumer process. The following processes are implemented:

  • The MortgageAppConsumer process invokes different operations implemented in the MortgageServiceProvider process. The SubmitFinDoc or CancelMortgage operation is called, based on the mortgage rate returned by the SubmitMortgageApp operation for a customer.
  • The MortgageServiceProvicer process implements the SubmitMortgageApp, SubmitFinDoc, or CancelMortgage operation. The SubmitMortgageApp operation generates and returns the mortgage app id and tentative mortgage rate, based on the customer's credit profile. The SubmitFinDoc operation submits the final mortgage documents. The CancelMortgage operation cancels the mortgage request.

For details about the conversation, select the Conversation tab for each of the following:

  • The SubmitMortgageAppOut Reply activity for initiating the conversation.
  • The SubmitFinDocIn Receive activity for joining the conversation.
  • The onEvent Event Handler for joining the conversation.

A conversation is evaluated to true if the value in Join matches the mortgageAppID generated by the SubmitMortgageApp operation for each mortgage request. This way, the mortgageAppID is used as a key to process a mortgage request for a customer.