Processing a continuous Data Stream
5 Tasks
20 mins
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.
Challenge Walkthrough
Detailed Tasks
1 Inspect the new Event Strategy
- Log in as the System Architect:
- In the User name field, enter SystemArchitect.
- In the Password field, enter rules.
- In the navigation pane of Dev Studio, click App to open the Application Explorer.
- In the Application Explorer, search for the Sample-Data-CallDetailRecords class.
- Expand Decision > Event Strategy, and then click DetectDroppedCallsRealtime to open the Event Strategy.
- 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
- 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.
- In the Label field, enter LocalCall, and then click Create and open.
- In the Property type section, click change, and then select True/False.
- In the upper-right corner, click Save.
3 Modify the Event Strategy
- In the Detect Dropped Calls Realtime Event Strategy, in the upper-right corner, click Check out.
- On the canvas, double-click the Filter Dropped Calls component to modify the filter properties:
- In the Name field, enter Filter Local Dropped Calls.
- In the Filter conditions section, click Add condition.
- In the first column, select the LocalCall field.
- In the Expression column, enter "true".
- Click Submit, and then, in the upper-right corner, click Check in.
- Enter appropriate comments, and then click Check in.
4 Modify the Data Flow
- 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.
- 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.
- Right-click the Detect Dropped Calls Event Strategy component, and then select Properties.
- In the Detect events section, select the DetectDroppedCallsRealtime Event Strategy.
- In the Properties output mapping section, click Add mapping to add the EventType field to the output.
- In the new mapping record, in the Sample-Data-FrequentlyDroppedCalls property field, enter.EventType.
- In the Detect Dropped Calls Realtime Event Strategy property field, enter or select EventType.
- 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
- 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.
- In the navigation pane of Dev Studio, click Records > Integration-Services > Service REST to open the list of available REST services.
- Click CallDetailRecordsSP to open the service, and then, in the upper-right corner, click Actions > Run.
- In the Simulate Rest Service Execution dialog box, in the HTTP Method section, select POST.
- 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"
}
- Click Execute to send the REST call, and then close the Simulation Results browser tab.
- In the Data Flow Run tab, check the Component statistics:
- Confirm that the Data Flow processed the REST call.
- Confirm that the source number of input records is now 1.
- 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.
- 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"
}
- Check the Component statistics:
- Confirm that the Data Flow processed the second REST call.
- Confirm that the source number of input records is now 2.
- 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.
- 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"
}
- Check the Component statistics:
- Confirm that the Data Flow processed the third REST call.
- Confirm that the source number of input records is now 3.
- Confirm that the Event Strategy produced an event because the system detected the second local, short, dropped call.
- Confirm that the destination data set contains the record.
- In the Dropped Calls Detection Real-time Data Flow, right-click the Frequently Dropped Calls destination component, and then select Open data set.
- In the Frequently Dropped Calls Data Set, in the upper-right corner, click Actions > Run to view the records.
- In the Run Data Set dialog box, in the Operation list, select Browse.
- 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.
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.
Want to help us improve this content?