Duplicate Lead ID in multi-node

Hi All,

we are generating a unique ID for Lead ID when running a campaign on Pega marketing with system random like this function:

com.pega.pegarules.pub.util.Random rnd = ThreadContainer.get().getSystemRandom();
String AB = “0123456789”;
int charLen = 9;
StringBuilder sb = new StringBuilder(charLen);
for(int i = 0; i < charLen; i++){
sb.append(AB.charAt(rnd.nextInt(AB.length())));
}
String uniqueID = sb.toString();
return uniqueID;

Lead ID is duplicated only in the PROD environment. In the lower environment, it does not occur and the difference between them is that only the PROD environment has a multi-node.

We tried running the activity with 5000 iterations in both the development and UAT environments and converted the result to a CSV file. The results did not show a duplicate Lead ID, indicating that we assume a duplicate Lead ID may occur when running on a multi-node.

Does anyone face this issue? Any ideas on what else might be the cause and fix for this? Thanks for replying.

Thanks,
Anggun

@AnggunMD In a multi-node environment, generating unique IDs using system random might not guarantee uniqueness across all nodes.

To ensure unique IDs, consider using a different approach, such as incorporating unique node IDs or leveraging Pega Platform’s built-in unique ID generation mechanisms. For example, you can use the unique ID generation feature in Pega Platform, which ensures unique IDs across nodes and environments. This will help you avoid duplicate Lead IDs in your production environment.

As a Support Center moderator, I reviewed the answer and references for accuracy

Configuring on-premises systems for monitoring with PDC

Generate sequential Unique ID for property without any prefix

Best practices for stream service configuration