Thursday, January 10, 2013

WORKING WITH EVENT TASKS



We can define events in the workflow to specify the sequence of task execution.
Types of Events:
  • Pre-defined event: A pre-defined event is a file-watch event. This event Waits for a specified file to arrive at a given location.
  • User-defined event: A user-defined event is a sequence of tasks in the Workflow. We create events and then raise them as per need.
Steps for creating User Defined Event:
  1. Open any workflow where we want to create an event.
  2. Click Workflow-> Edit -> Events tab.
  3. Click to Add button to add events and give the names as per need.
  4. Click Apply -> Ok. Validate the workflow and Save it.
Types of Events Tasks:
  • EVENT RAISE: Event-Raise task represents a user-defined event. We use this task to raise a user defined event.
  • EVENT WAIT: Event-Wait task waits for a file watcher event or user defined event to occur before executing the next session in the workflow.
Example1: Use an event wait task and make sure that session s_filter_example runs when abc.txt file is present in D:\FILES folder.
Steps for creating workflow:
  1. Workflow -> Create -> Give name wf_event_wait_file_watch -> Click ok.
  2. Task -> Create -> Select Event Wait. Give name. Click create and done.
  3. Link Start to Event Wait task.
  4. Drag s_filter_example to workspace and link it to event wait task.
  5. Right click on event wait task and click EDIT -> EVENTS tab.
  6. Select Pre Defined option there. In the blank space, give directory and filename to watch. Example: D:\FILES\abc.tct
  7. Workflow validate and Repository Save.
clip_image001

Example 2: Raise a user defined event when session s_m_filter_example succeeds. Capture this event in event wait task and run session S_M_TOTAL_SAL_EXAMPLE
Steps for creating workflow:
  1. Workflow -> Create -> Give name wf_event_wait_event_raise -> Click ok.
  2. Workflow -> Edit -> Events Tab and add events EVENT1 there.
  3. Drag s_m_filter_example and link it to START task.
  4. Click Tasks -> Create -> Select EVENT RAISE from list. Give name
  5. ER_Example. Click Create and then done.Link ER_Example to s_m_filter_example.
  6. Right click ER_Example -> EDIT -> Properties Tab -> Open Value for User Defined Event and Select EVENT1 from the list displayed. Apply -> OK.
  7. Click link between ER_Example and s_m_filter_example and give the condition $S_M_FILTER_EXAMPLE.Status=SUCCEEDED
  8. Click Tasks -> Create -> Select EVENT WAIT from list. Give name EW_WAIT. Click Create and then done.
  9. Link EW_WAIT to START task.
  10. Right click EW_WAIT -> EDIT-> EVENTS tab.
  11. Select User Defined there. Select the Event1 by clicking Browse Events button.
  12. Apply -> OK.
  13. Drag S_M_TOTAL_SAL_EXAMPLE and link it to EW_WAIT.
  14. Mapping -> Validate
  15. Repository -> Save.
  16. Run workflow and see.
clip_image001[5]


No comments:

Post a Comment

Thank you :
- kareem