Basics of Integration in Pega
Basics of Integration

Basics of Integration in Pega

Summary:

This article explains about the basic concepts/terminologies that we should know before implementing integration in Pega.

Integration is easy for the one who thinks it’s easy and difficult for the one who thinks it’s difficult.

This article covers all the basic concepts & terminologies which one should know before learning how Connectors and Services function in Pega. Let’s make basics familiar and then can master integration from our further posts.

From the OSP dictionary, we would define Integration as the process of communication to share data across systems.

When Humans talk with each other it’s called as Communication and when systems talk with each other it’s called as Integration.

Let us assume a common scenario where a customer walks into a bank to inquire about his/her loan eligibility. The series of action that involves during this end-end process would be,

In this scenario, customers and bank employees communicate with each other to get their work done.

What happens if the same scenario needs to be handled systematically. This means a customer wishes to inquire about their details online and the bank wishes to have an automated response to the customer rather than having a bank employee respond !!!

System A: Customer Inquiry application where customers can inquire about all their needs.
System B: Banking application that has all the customer details stored.

Now we have two systems and communication happens between systems rather than the person.

End to end integration execution involves the below process.

This cycle covers only the happy path without any exception path.

Let’s understand each of these components in detail below.

Service provider/Server

  • Services are instances of class Rule-Service-XXXX, namely Rule-Service-REST, Rule-Service-SOAP, etc.
  • As we all know, a server basically helps to store and retrieve information whenever required.
  • In the same way, a service provider is a system that will have the required information which can be exposed to other clients in the form of Services.
  • In our above example, system B acts as a service provider and hosts a service that system A can connect with to get the required information.
Integration when Pega acts as a Server/Service provider.

Connector/Client

  • Connectors are instances of class Rule-Connect-XXXX, namely Rule-Connect-REST, Rule-Connect-SOAP, etc.
  • The client is basically a system that requests information from server/service.
  • In our above example, System A acts as a Client/Connector requesting data from System B. System A sends the request to System B and gets the required data.
Integration when Pega acts as a Client/Connector.

Authentication

  • In our above scenario, the Customer reaches the bank and provides his/her identity to get the required information.
  • In the same way, when system A communicates with system B, it should confirm its identity in the form of Authentication.
  • Authentication can be of many forms which can be discussed detail in a separate post. System A should Authenticate its identity before getting the required information from system B.

Messaging Formats

  • The customer reaches the bank and communicates using the language that the bank employee understands. In the same way, system A will communicate with system B using the language that system B understands/support. System B then responds back to system A with the requested information using the same language. The language defined here is the messaging format that the system uses to communicate.
  • JSON and XML are the most commonly used messaging formats.

JSON

JSON is easily readable/parseable, lightweight JavaScript Object Notation language.

In our above example, System A can request Loan Eligibility by sending the Customer detail as request in JSON format as mentioned below :

{
CustomerID“: “A-123”,
AccountNumber“: “11112222”
}

XML

XML is a mark up language where information is wrapped in tags.

In our above example, System A can request Loan Eligibility by sending the Customer detail as request in XML format as mentioned below :

<CustomerID>A-123</CustomerID>
<AccountNumber> 11112222 </AccountNumber>

Protocols

The most commonly used type of services is REST(Representational State Transfer) and SOAP (Simple Object Access Protocol).

SOAP

  • It uses XML as its message format for exchanging information between client and server
  • Soap service is a legacy way to interact with an external system.
  • Soap offers more secure communication as it supports WS-Security encryption.

REST

  • It uses HTTP based protocol to communicate with the server.
  • It uses XML, JSON or Text format to send request/receive response.
  • Pega supports Get, Post, Put, Delete and Patch HTTP methods. [We will discuss more in detail about Rest methods in the next post].
  • It generally uses JSON which consumes less bandwidth and resource than XML. Hence REST is preferred over SOAP for faster communication.

Mapping Rules

Mapping rules are kind of translators which translates message formats into Pega understandable structure & vice-versa. Mapping rules can be broadly classified into two types,

  • Parse rules.
  • Stream rules.

Parse rules

  • Parse rules are instances of class Rule-Parse-XXXX. For example, Rule-Parse-XML, Rule-Parse-Delimited, etc.
  • Parse rules are used to translate the incoming message format (XML) into Pega understandable structure (Clipboard).

Stream rules

  • Stream rules is available only for XML and is instances of class Rule-Obj-XML.
  • Stream rules are used to translate the pega clipboard structure to common message format (XML).

Service Package

Service package in Pega are instances of class Data-Admin-ServicePackage.

Configurations specific to a service can be directly configured in the service rule itself, for example, request, response, error handling, etc. But few configurations will be common across services and hence it’s required to group those services together and get the configuration done in one place [Service Package].

Yes, Service Package in Pega is used to group similar services into one group. Service package can be viewed and created from Records Explorer->Integration-Resources category-> Service Package.

Few configurations that can be handled in the service packages are,

Processing mode

Processing mode defined in the service package defines the way service rule is executed. It can possibly be Stateful or Stateless.

Let’s consider a real-time scenario to understand stateful and Stateless processing mode rather than boring theoretical definitions.

Consider an Employee onboarding application where the employee will undergo a series of actions before getting successfully onboarded.

  • Updating Basic Information.
  • Updating Educational information.
  • Updating Work History.

The employee will update all his/her information in an external system and Pega captures and save all the information using Services. The above series of actions are handled by different services in Pega.

  • Service package to group all services related to employee onboarding with Stateful processing mode.

Service 1 in the series – Employee basic info

Let us hit the first service from the PostMan tool and observe its execution.

Service execution from the PostMan tool
All the basic information is filled after the service execution
Service activity of Service 1.

Service 2 in the series – Employee educational info

Execution of service 2 from the PostMan tool
All the educational information is filled after the service execution

Since the processing mode is stateful, the system maintains the current requestor and processes the upcoming request in the same requestor. Hence EmpInfo page will already be available & hence obj-open can be skipped in the service activity.

Service activity of Service 2.

Service 3 in the series – Employee work history

Execution of service 3 from the PostMan tool
All the work history information is filled after the service execution

Since the processing mode is stateful, the system maintains the current requestor and processes the upcoming request in the same requestor. Hence EmpInfo page will already be available & hence obj-open can be skipped in the service activity.

Service activity of Service 3

Since this being the last service in the series of stateful processing, make sure we select End Requestor when done in the service rule. This option in service rule ensures that the requestor is closed after the execution of the service.

  • If the execution of each service can be handled using separate requestors, then processing mode can be selected as Stateless.
  • The default processing mode is Stateless. It can be updated to Stateful based on the need.

Service Access Group

Browser requestors get the application context by the access group mapped to the Operator ID. Services are executed as App requestors and from where does the application context come from during service execution?🧐

The service access-group mentioned in the service package will be used to define the application context for all the services tagged under this service package.

In our scenario Onboarding:Services access group will be used during service execution.

Requires Authentication

This option in the service package is used to define the type of authentication that is to be used for the services under this package. It can either be one of the below,

  • Basic-> UserName and Password
  • OAuth 2.0 -> This is an advanced type of authentication. This involves configuring OAuth client Registration which is a separate security rule in Pega.
  • Custom -> Any authentication service created under custom type can be mentioned here.

It is recommended to secure our service with at least basic authentication.

Methods

Methods section in service package will give you the list of services tagged under this service package. Services will be grouped using the service type.

We hope now the basics of Integration is clear. We will soon meet with a post on step by step configuration of Service REST in Pega followed by Connect REST and other protocols..

Stay tuned and we will meet soon in our Service REST post.

OSP TEAM
Written by
OSP Editorial Team

Recent Jobs from our community

loading
View more Jobs on OSP Forum
Join the discussion

Feel free to post your questions here about this topic if any. We will definitely get back to you ASAP !!!
If you have any off-topic questions, Let's discuss at OSP Forum

17 comments
  • Thank you for sharing the knowledge. This is way better presentation than the normal pega courses. The more we scroll, the more we get interested in learning. Awaiting follow-up topics on same.

  • Consider a scenario where we have S1,S2 services under same service package and we get multiple requests from external system at same time :

    S1,S2 are Independent services : We use stateless mode and for each request a new requestor is created and as they are independent they work fine for multiple requests at same time.

    S1,S2 Dependent services and should be executed in same sequence(similar to Employee onboarding) : We use stateful mode here so that we can maintain the clipboard pages generated in S1. when we get multiples requests for S1 at same time how will we manage the clipboard pages. We will lose the first S1 request right.

    • Only if the service invocation will be in the specified order, Stateful will suffice. In other scenarios, it will not work as expected.

      To answer your question, when you have multiple S1 requests, you should end up using Stateless.

  • The main uses of service Package :

    Group dependent services that requires Stateful Processing
    Group Independent Services with common configurations like Access Group,Pooling,Authentication

    Any other uses of service Package

    • Service Package is the heart of your service rule. It co-ordinates the entire requestor pool. It keeps tracks of all the Active, Idle requestors in the pool.

      It also keeps track of the invocation history of the grouped services. Though it looks simple in terms of configuration, it is a key component in Integration.

  • The default PRPC:Unauthenticated access group that is configured in APP Requestor doesn’t have access to Service Package class (Data-Admin-ServicePackage) data instances.
    How is the APP Requestor with this Initial Context going to look into Service Packages without access.

    • Whenever we create and configure a new service package, a requestor pool will be created. APP requestors just create an active requestor in the pool rather than hitting the service package. The requestor pool can be seen in your Admin Studio.

      • I thought the access group in the APP requestor helps to find outs the service package and change APP Requestors context to the access group specified in the Service Package.

        Then what exactly is the use of access group in the APP Requestor

        Thanks in Advance.

  • Hi Team,
    Thanks for all the post,very useful information.

    I have few queries.
    1. I created a service rest in pega .I want to get the json file to share to the consumer ,how to get the sample json file.

    As we have many methods get,put,post, delete,patch . When a new request hits service rest how will Service-Rest rule knows if it’s is for put /post /delete Nd executes the particular method.
    I select asynchronous processing and queue to execution , now an advanced or standard agent we should be processing ryt,can you tell in brief what steps and how to proceed.

  • The way you guys have explained the concepts, truly shows your passion on the technology. Appreciate all your effort in making it easy for readers to understand the concept with simple examples. Just love these blogs. I always refer to the topics covered here while preparing for interview. Gives good knowledge to answer to some complication questions during interviews. Will definitely recommend this website to all my fellow Pega developers. Keep up the good work. Looking forward to see more topics covered in the future.

  • If Authenticated, then access group of authenticated operator is used to set context rather than access group mentioned in service package to find all relevant application specific rules.

    The context is reset once requester returns back to the pool.