Configuring a Conversation to Join a Wait for File Change Activity

The Wait For File Change activity initiates and joins conversation with a File Poller activity to implement a process conversation.

Procedure

  1. In the samples directory, select core > conversation > WaitForFileChange and double-click tibco.bw.sample.core.conversation.WaitForFileChange. For more information, see Accessing Samples .
  2. In theProject Explorer view, expand the tibco.bw.sample.core.conversation.WaitForFileChange 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 tibco.bw.sample.core.conversation.WaitForFileChange.application and double-click Properties. The output file locations defined for the application displays in the dialog.
  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.WaitForFileChange.application.
  8. Click Debug.
    This runs the sample in Debug mode.
  9. After completing the Scenario1 and 2, click the Terminate icon to stop the process.

Result

The request is Approved.

Understanding the Configuration

Procedure

  1. Trigger.bwp process creates Trigger.log and this triggers a job.
  2. Trigger.bwp process creates Req.log and writes "Approved" in the same file. This triggers event for the "Wait For File Change".
  3. When the Wait for File Change activity executes, the process instance suspends and waits for the specified change to occur before resuming.
    Output file gets created at: c:\tmp\WaitForFileChange\WaitForFileChange.log with content: "The request is Approved."
  4. The RemoveApprovalFile activity removes the Req.log file from c:\tmp\WaitForFileChange.
  5. TriggerAnotherJob: This activity triggers another job and process execution waits at Wait For File Change activity for matching the correlation keys.
  6. If the user creates Req.log file at location c:\tmp\WaitForFileChange with content "Rejected", then conversation gets executed successfully and the output file at c:\tmp\WaitForFileChange\WaitForFileChange.log gets updated as mentioned below:

    The request is Approved.

    The request is Rejected.