Using an Asynchronous Event Handler to Implement a Simple Mortgage Workflow
Mortgage application consumer and provider processes interact with each other through the message correlation mechanism. The event handler invocation allows for asynchronous event processing and runs the logic parallel to the main business logic of the process.
- Procedure
- In the samples directory, select and double-click tibco.bw.sample.core.event.AsyncEventHandler. For more information, see Accessing Samples.
- In Project Explorer, expand the tibco.bw.sample.core.event.AsyncEventHandler project.
- Fully expand the Processes directory and double-click the MortgageAppConsumer.bwp and the MortgageAppProvider.bwp processes.
- Click .
- At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
- Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the checkbox next to tibco.bw.sample.core.event.AsyncEventHandler.application.
- Click
Debug.
This runs the sample in Debug mode.
- Click the
Terminate
icon to stop the process.
12:19:45.639 [bwThread:In-Memory STWorkProcessor-2] INFO c.t.b.p.g.L.t.b.s.c.e.A.LogSubmitMortgage - ### Received SubmitMortgageApp()
12:19:45.670 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log - Cancel Application F54734546
12:19:45.685 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log - Cancel Application F54734546
12:19:45.685 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log - Cancel Application F54734546
12:19:45.701 [bwThread:In-Memory STWorkProcessor-8] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log - ### Done, get Mortgage Rate: 9.1
Understanding the Configuration
There are two processes in the supplied project:
- MortgageAppProvider: This is a Mortgage service with three operations, the SubmitMortgageApp, SubmitFinDoc and the CancelMortgageApp operations defined in the event handler container. Both the CancelMortgageApp and SubmitFinDoc operations have a correlation key obtained from the response to the operation SubmitMortgageApp.
- MortgageAppConsumer: The consumer invokes the
CancelMortgageApp operation before the operation
SubmitFinDoc: This way, the service calls
CancelMortgageApp after receiving the correlation message key,
mortgageAppID: The
CancelMortgageApp activity has the input properties configured as shown in the following image:
