Creating and writing into Stream Data Sets
3 Tasks
20 mins
Beginner
Pega Platform '24.2
English
Scenario
In the Sample application, a new Sample-Data-Transactions class is available with the following Data Model:
Field | Type | Description |
---|---|---|
TransactionID |
Identifier |
Unique transaction identifier |
CardNumber |
Text |
The card number associated with the transaction |
Amount |
Decimal |
The amount of the transaction |
Currency |
Text |
The currency of the transaction |
MerchantName |
Text |
The name of the merchant |
MerchantCategory |
Text |
Merchant category |
TransactionTime |
Date time |
The data and time of the transaction |
The following artifacts are available for you:
- A Transaction Service Service Package Rule that determines the security scheme and access for the services in the package.
- A Card Transactions Service REST Rule that exposes a REST API that the system can call externally.
- An InsertIntoStream Activity Rule that saves the incoming data to a Stream Data Set.
Create a new Transaction Stream Data Set, and use the provided Service REST Rule to create a new record in the stream.
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: Create a new Stream Data Set
Create Transaction Stream Stream Data Set in the Sample-Data-Transactions class. Review the JSON payload for writing to the stream.
Task 2: Write to the Stream Data Set
Using the provided Card Transactions REST service, create a new transaction record in the Transaction Stream Data Set.
Note: For the purposes of the exercise, the following Rules are created by the System Architect
A Service Package Rule, Transaction Service, determines the security scheme and access for the services in the package.
A Service REST Rule, Card Transactions, that exposes a REST API that can be called externally.
An Activity Rule, InsertIntoStream, saves the incoming data to a Stream Data Set.
A Service Package Rule, Transaction Service, determines the security scheme and access for the services in the package.
A Service REST Rule, Card Transactions, that exposes a REST API that can be called externally.
An Activity Rule, InsertIntoStream, saves the incoming data to a Stream Data Set.
Task 3: Preview the data in the Stream Data Set
Browse the data available in the Stream Data Set.
Challenge Walkthrough
Detailed Tasks
1 Create a new Stream Data Set
- 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-Transactions class.
- In the Application Explorer, right-click the Sample-Data-Transactions class, and then select Create > Data Model > Data Set.
- On the Create Data Set tab, create a new Data Set:
- In the Label field, enter Transaction Stream.
- In the Type list, select Stream.
- In the upper-right corner, click Create and open.
- On the Data set: Transaction Stream tab, in the upper-right corner, click Save.
2 Write to the Stream Data Set
- In the header of Dev Studio, in the search field, enter Transaction Service, then click enter.
- In the search results, click the TransactionService Service REST Rule.
Note: For the purposes of the exercise, the System Architect preconfigures the Card Transactions Service Rest Rule. The service invokes the InsertIntoStream Activity Rule that inserts the incoming payload to the TransactionStream Data Set.
- In the Service REST: Card Transactions Rule, in the upper-right corner, click Actions > Run.
- In the Simulate REST Service Execution window, complete the following settings:
- In the HTTP Method section, select POST.
- In the Message Buffer section, enter the following payload.
Note that this payload shares the same structure as the payload generated in the Transactions Stream Data Set.{
"CardNumber" : "1234123412341234",
"TransactionTime" : "20230929T130349.756 GMT",
"MerchantName" : "Sample Merchant",
"MerchantCategory" : "Travel",
"Currency" : "USD",
"Amount" : "280",
"TransactionID" : "TID-1"
} - Click Execute.
- Confirm that the Service Simulation Results returns a Success status, and then close the window.
3 Preview the data in the Stream Data Set
- In the Application Explorer, search for the Sample-Data-Transactions class.
- In the Application Explorer, click Data Model > Data Set, then click TransactionStream.
- On the Data set: Transaction Stream tab, in the upper-right corner, click Actions > Run.
- In the Data Set Preview window, view the data:
- In the run context, in the Operation list, select Browse.
- In the upper-right corner of the run context, click Run to view the run results.
- Review the Result(1).
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?