Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Learning about real-time applications and push notifications in Pega Platform

Updated on October 22, 2021

You can build reliable, scalable real-time applications with Pega Platform™ without having to use additional components or third-party solutions. The Pega Platform provides a built-in notifications feature that application components can use to communicate in real time.

Based on the publish/subscribe (pub/sub) messaging pattern, this feature helps nodes in a cluster to push notifications to browser clients.

Use cases

The use cases for real-time messaging and push notifications are numerous and include:

  • Streaming data: From real-time dashboards to activity streams, streaming data is a key requirement for integrated applications.
  • Online availability: From chat applications to online collaborators, knowing who is online and what their status is can enhance decision-making at an organizational level.

Key components

Real-time messaging in the Pega Platform is based on the pub/sub messaging pattern. In this pattern, messages are published to a topic that broadcasts the messages to all interested subscribers. Messages are delivered according to the best-effort delivery paradigm.

 

Connections

By default, the Pega Platform uses WebSockets to establish a connection with the browser client immediately after a requestor logs in. If the Pega Platform cannot establish a WebSocket connection, it uses long polling. The connection is active until the requestor logs out, is passivated, or is timed out.

A long-polling connection has a performance degradation of 10.1% compared with a WebSockets connection.

Channels

Channels are named destinations (or topics) that can receive messages from a node and broadcast messages to all registered subscribers.

You can set up your own notification channel that can be subscribed to by any dynamic layout. You create a notification channel from the Notification channels landing page.

Landing page for notification channels

Notification channels

For example, Operator Presence is a notification channel to which all the operators publish their state and status changes. UI components can subscribe to this channel to get real-time status of logged-in operators without any repeated requests.

Publisher

Any data source can publish messages to a notification channel in response to an event.

You can use the Publish-Notifications method in an activity to publish messages to a channel that is specified as a parameter. If the channel was configured to receive specific properties, only those properties are published. If not, all the top-level scalar and value list properties on the step page are published to the channel.

To improve performance, publish only selected properties instead of a full page.

Publish activity in Pega 7 Platform

Publish activity in the Pega Platform

Messages

A real-time message is composed of top-level scalar and value list properties on a clipboard page. The page is encapsulated and sent to the channel. When the broadcasted message is received by a node, the context of the message is checked against the subscriptions available on the node. If the contexts match, the message is delivered in JSON format.

{
"data":{
"response":{
"pyWorkGroup":"default@push",
"pyUserIdentifier":"user",
"pyUsage":"online"
},
"requestorId":H92042627B13D768D330D1885CBC4C55"
}
"format":"application/json"}
}
"channel":"Data-Admin-Operator_ID/pyWorkGroup/default@push",
"clientId":"H92042627B13D768D330D1885CBC4C55"}

Subscriber

Clients interested in data changes triggered by events need to subscribe to a channel that is configured to receive those data changes. Subscribers can filter messages from a channel based on a specific property. For example, the my stock widget app should receive real-time updates only for pharmaceutical industry stocks (.pyIndustryType = "Pharma").

You can configure any dynamic layout to subscribe to a specified channel. If the dynamic layout is not accessible to JavaScript, notifications cannot be delivered.

To subscribe to a channel, create an action set that is based on the On Load event. When specifying a callback action, avoid refreshing the same section because this can cause the dynamic layout to unsubscribe and subscribe again.

Subscription process

Subscription process

When a message is received on a server node, the subscriber determines whether the message context applies to any subscriptions on the node. If there are matching subscriptions, the specified callback actions are invoked.

Diagnostics

You can debug the subscribe and publish operations if you enable the following loggers at debug level:

com.pega.pegarules.session.internal.serverpush – debug

com.pega.platform.message – debug

You can monitor real-time notifications in your application using the following MBeans:

com.pega.pegarules.management.internal.PushServerMonitorManagement

com.pega.pegarules.management.internal.NotificationMonitorManagement

Example

Consider a contact center ticket system where team members and other stakeholders simultaneously update a work item. The various activities performed on this work item are maintained as a log file or social stream.

You can improve customer experience and team collaboration by configuring your application to receive instant updates from customers or when a high-priority ticket is assigned to a user.

  • Identify the real-time data that you are interested in, for example, a comment by a customer (.pyMessage) on the work item or a high-priority item (.pyPriority="Critical") that should be immediately reflected in the feed or worklist.
  • Create a notification channel to which the changes to a worklist or activity log are published. For example, you might create a notification channel PriorityTickets and CustomerUpdates based on your high-level class that contains the priority tickets and activity feeds.
  • Configure the dynamic layout that holds your worklist and activity feed to subscribe to messages from PriorityTickets and CustomerUpdates with the required conditions.

Whenever a high-priority ticket is assigned to you, your dashboard is automatically updated. An update from a customer is instantly reflected in your feed.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

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.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us