Skip to main content

Processing a continuous Data Stream

5 Tasks

20 mins

Visible to: All users
Beginner
Pega Platform '24.2
English

Scenario

U+ Comms, a sizable telecommunications company, aims to promptly assist customers who often experience dropped calls. To detect the dropped calls, the company developed a new Event Strategy that detects the third dropped call within one week. It also detects if there are two short, dropped calls within five days.

To limit the initial scope of the enhanced customer service, the Event Strategy must apply to local calls only, not international calls. To implement this requirement, you add a new LocalCall Boolean property to the Data Model, and then make the necessary changes to the Event Strategy.

Modify the Data Flow to reference the Event Strategy and to include the Event Type field, which you set in the components that precede the Emit component in the Data Stream in the outcome. With this configuration, you can process the data from multiple paths in the Data Stream separately.

To test the Event Strategy with a real-time data stream, you start the Data Flow that references the modified Event Strategy and use the internal REST service to send REST calls to populate the source data set of the Data Flow.

Use the following credentials to log in to the exercise system:

Role User name Password
System architect SystemArchitect rules

Your assignment consists of the following tasks:

Task 1: Inspect the new Event Strategy

Inspect the components of the Detect Dropped Calls Realtime Event Strategy.

Task 2: Add a Boolean property to the Data Model

Add the LocalCall boolean property to the Data Model to store the local or international status of the call.

Task 3: Modify the Event Strategy

Use the LocalCall property to modify the Detect Dropped Calls Realtime Event Strategy to filter local calls.

Task 4: Modify the Data Flow

Modify the Dropped Calls Detection Real-time Data Flow to reference the new Event Strategy and to store the EventType field.

Task 5: Send REST calls to the Data Flow

Use the CallDetailRecordsSP REST service to send real-time data stream and verify the results.

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Inspect the new Event Strategy

  1. Log in as the System Architect:
    1. In the User name field, enter SystemArchitect.
    2. In the Password field, enter rules.
  2. In the navigation pane of Dev Studio, click App to open the Application Explorer.
  3. In the Application Explorer, search for the Sample-Data-CallDetailRecords class.
  4. Expand Decision > Event Strategy, and then click DetectDroppedCallsRealtime to open the Event Strategy.
    DetectDroppedCallsRealtime Event Strategy canvas
  5. Inspect all components of the Event Strategy.
    Can you explain under what circumstances it produces an output?
    Tip: The Event Strategy uses a split component to employ two separate windows: a window in the primary path of five days that emits an event when two short dropped calls are detected and another window in the secondary path of a week that emits an event if three dropped calls are detected.

2 Add a Boolean property to the Data Model

  1. In the Application Explorer, on the Classes tab, right-click the Sample-Data-CallDetailRecords class, and then select Create > Data Model > Property to create a new property in this class.
  2. In the Label field, enter LocalCall, and then click Create and open.
  3. In the Property type section, click change, and then select True/False.
    A screenshot of a dropdown menu in a software interface for selecting the property type with options such as Single Value Page and Advanced
  4. In the upper-right corner, click Save.

3 Modify the Event Strategy

  1. In the Detect Dropped Calls Realtime Event Strategy, in the upper-right corner, click Check out.
  2. On the canvas, double-click the Filter Dropped Calls component to modify the filter properties:
    1. In the Name field, enter Filter Local Dropped Calls.
    2. In the Filter conditions section, click Add condition.
    3. In the first column, select the LocalCall field.
    4. In the Expression column, enter "true".
      A screenshot of a filter configuration interface titled Filter Local Dropped Calls with conditions set to filter calls with a CompletionStatus of Dropped and LocalCall equal to true
  3. Click Submit, and then, in the upper-right corner, click Check in.
  4. Enter appropriate comments, and then click Check in.

4 Modify the Data Flow

  1. In the Application Explorer, in the Sample-Data-CallDetailRecords class, expand Data model > Data Flow, and then click Dropped Calls Detection Real-time to open the Data Flow.
  2. In the Dropped Calls Detection Real-time Data Flow, in the upper-right corner, click Save as to create a copy of the Data Flow, and then click Create and open.
  3. Right-click the Detect Dropped Calls Event Strategy component, and then select Properties.
  4. In the Detect events section, select the DetectDroppedCallsRealtime Event Strategy.
  5. In the Properties output mapping section, click Add mapping to add the EventType field to the output.
    1. In the new mapping record, in the Sample-Data-FrequentlyDroppedCalls property field, enter.EventType.
    2. In the Detect Dropped Calls Realtime Event Strategy property field, enter or select EventType.
      Properties output mapping dialog
  6. Click Submit to close the Event strategy configurations dialog box, and then, in the upper-right corner, click Save.

5 Send REST calls to the Data Flow

  1. In the Dropped Calls Detection Real-time Data Flow, in the upper-right corner, click Actions > Run, and then click Run to start the Data Flow.
  2. In the navigation pane of Dev Studio, click Records > Integration-Services > Service REST to open the list of available REST services.
  3. Click CallDetailRecordsSP to open the service, and then, in the upper-right corner, click Actions > Run.
  4. In the Simulate Rest Service Execution dialog box, in the HTTP Method section, select POST.
  5. In the Message Buffer section, enter the payload, which represents a short, international, dropped call:
    {
    "CompletionStatus" : "Dropped",
    "CallDetailRecordID" : "ID01",
    "PhoneNumber" : "111-1111",
    "Duration" : 3,
    "LocalCall" : false,
    "TimeOfCall" : "20231117T113818.796 GMT"
    }
  1. Click Execute to send the REST call, and then close the Simulation Results browser tab.
  2. In the Data Flow Run tab, check the Component statistics:
    1. Confirm that the Data Flow processed the REST call.
    2. Confirm that the source number of input records is now 1.
    3. Confirm that the Event Strategy did not produce an event because the payload has LocalCall set to false. Although the duration is short, the system does not count the record as part of the window.
      Component statistics after the first event
  3. Send a second REST call with the following payload, which represents a short, local, dropped call:
    {
    "CompletionStatus" : "Dropped",
    "CallDetailRecordID" : "ID02",
    "PhoneNumber" : "111-1111",
    "Duration" : 3,
    "LocalCall" : true,
    "TimeOfCall" : "20231117T113818.796 GMT"
    }
  1. Check the Component statistics:
    1. Confirm that the Data Flow processed the second REST call.
    2. Confirm that the source number of input records is now 2.
    3. Confirm that the Event Strategy did not emit an event because only a single local, short, dropped call counts as part of the window, and the Event Strategy produces an output when the system detects two local, short, dropped calls.
      Component statistics after the second event
  2. Send a third REST call with the following payload, which represents a second short, local, dropped call:
    {
    "CompletionStatus" : "Dropped",
    "CallDetailRecordID" : "ID03",
    "PhoneNumber" : "111-1111",
    "Duration" : 3,
    "LocalCall" : true,
    "TimeOfCall" : "20231117T113818.796 GMT"
    }
  1. Check the Component statistics:
    1. Confirm that the Data Flow processed the third REST call.
    2. Confirm that the source number of input records is now 3.
    3. Confirm that the Event Strategy produced an event because the system detected the second local, short, dropped call.
    4. Confirm that the destination data set contains the record.
      Component statistics after the third event
  2. In the Dropped Calls Detection Real-time Data Flow, right-click the Frequently Dropped Calls destination component, and then select Open data set.
  3. In the Frequently Dropped Calls Data Set, in the upper-right corner, click Actions > Run to view the records.
  4. In the Run Data Set dialog box, in the Operation list, select Browse.
  5. Click Run, and then verify that the detected output corresponds to the mobile phone number that you used in the payload and that the EventType reflects the Event Flow split path.
    The Event Strategy with the filter component
    A screenshot showing a data table with properties and values

This Challenge is to practice what you learned in the following Module:


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice