Modularity Among Applications with a Shared Module Project

This sample shows how modularity can be achieved among two application module projects and a shared module project.

Two scenarios in this sample show how a process in a shared module can be used by other application modules, without requiring changes to the contents of the shared module. The scenarios are demonstrated in the following projects:

Application Module Projects

  • tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer
  • tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent

Shared Module Project

  • tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule

Procedure

Scenario 1

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

Scenario 2

  1. In the AppsWithSharedModule directory, double-click the tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent project.
  2. Click Run > Debug Configurations.
  3. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication
  4. 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.modularity.AppsWithSharedModule.App.TimerEventComponent.application.
  5. Click Debug.
    This runs the sample in Debug mode.
  6. Click the Terminate icon to stop the process.

Result

Scenario 1

The following messages are written by the shared module and application module to the helloWorldServiceConsumer.log file at c:\tmp\AppsWithSharedModule location.

  • --> LogMessage from HelloWorldServiceProcess for John
  • --> Hello John from HelloWorldServiceProcess

Scenario 2

The following messages are written by the shared module and application module to the timerEvent.log file at c:\tmp\AppsWithSharedModule location.

  • --> LogMessage from TimerEventProcessTimerEventProcess
  • --> Hello TimerEventProcess--> from LogMessage from TimerEventProcess

Understanding the Configuration

Scenario 1: The MainProcess included in the tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer application module, invokes the HelloWorldServiceProcess in the tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule. The Write To File activity logs the output from the calling process, HelloWorldServiceProcess.

Scenario 2: The Process included in the tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent application module invokes the TimerEventProcess in the tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule.