Inter Process Communication using Wait for Notification and Notify Activities

This sample explains inter-process communication using the Notify and the Wait for Notification activities in different processes. One process notifies the other waiting process using these activities. These activities are co-related using the key configured on the General tab and the same Notify Configuration resource configured for both the activities.

Procedure

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

Result

A waitnotify.log file is created in the C:\tmp\WaitNotify folder of the default location, or the path you specified earlier. This file contains the information similar to the following:

Main Process: Started the main process

Main Process: Spawning non-inline sub process

Main Process: Activity Waiting for the notification

Sub Process : Non-inline sub process started

Sub Process : Notification sent for the waiting activity

Main Process: Notification Received from the other process with Data: Results sent from the notifying process

Understanding the Configuration

The scenario depicts a simple inter process communication use case.
  • The main process is triggered through a Timer activity.
  • The main process spawns a non-inline sub process.
  • The main process then starts waiting, using a Wait for Notification activity.
  • The spawned sub process sends the notification for the waiting activity using a Notify activity and proceeds further.
  • The Wait for Notification activity in the main process receives the notification and proceeds further.