Support Article

Page passed as a parameter to a queued activity throws exception

SA-38819

Summary



In a main Activity user creates a Page and passes its name as a parameter to another Activity using following two ways:

1. Once by using Call method and invoke the “Child” Activity
2. Another by using Queue method to invoke the same "Child” Activity

When using Call method, the “Child” activity is able to read the property of the created Page and log it correctly.

When using Queue method, the same activity with the very same Page parameter throws an InvalidReferenceException.


Error Messages

com.pega.pegarules.pub.clipboard.InvalidReferenceException: The reference "Mode: " + Param.Mode + ".pyID: " + .pyID is not valid. Reason: FUAInstance-NullMyStepPage
at com.pegarules.generated.activity.ra_action_child_ca4c8706e85d638d4c3e88e38ab60b5c.step2_circum0(ra_action_child_ca4c8706e85d638d4c3e88e38ab60b5c.java:214)
at com.pegarules.generated.activity.ra_action_child_ca4c8706e85d638d4c3e88e38ab60b5c.perform(ra_action_child_ca4c8706e85d638d4c3e88e38ab60b5c.java:89)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3553)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:646)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivities(ThreadRunner.java:572)
at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivities(PRThreadImpl.java:457)
at com.pega.pegarules.session.internal.async.agent.QueueProcessor.executeBatchTask(QueueProcessor.java:260)
at com.pega.pegarules.session.internal.async.agent.QueueProcessor.execute(QueueProcessor.java:325)
at com.pega.pegarules.session.internal.async.BatchRequestorTask.run(BatchRequestorTask.java:1000)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.performTargetActionWithLock(PRSessionProviderImpl.java:1286)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1034)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:916)
at com.pega.pegarules.session.internal.async.BatchRequestorTask.run(BatchRequestorTask.java:707)
at com.pega.jsr166backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:991)
at com.pega.jsr166backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:532)
at java.lang.Thread.run(Thread.java:745)


Steps to Reproduce



1. Create one "main" activity that creates a page and sets one of the properties to a given value.
2. *Call* another "Child" activity and pass the page as a parameter.
3. In the "Child" activity, declare a parameter of type "Page Name" and use it as a Step Page for a Log-Message command that prints the property set above.
4. Observe in the log that the property was logged with the correct value set at step 1.
5. From the "main" activity now *Queue* the same "Child" activity and pass again the page as a parameter.
6. Observe in the log that an exception was thrown.


Root Cause



This is working as designed.

Resolution



Here 's an explanation:

When using "Call" "Child" activity, the execution is sequential and occurs within the same requestor context. The clipboard page built within that requestor is available to "Child" activity.
What you are passing across in the parameter page is just the name of the page. Hence when the “Threaded” activity is executed that same page is available in the context and it works.

When using "Queue" Threaded activity, this will cause "Child" activity to run asynchronously. No step page and primary page is passed.
Only parameter page is passed across.

However parameter page is a String valued collection of name parameters hence passing across the name of the page.
When calling any activity using Queue method, the execution occurs on a separate requestor hence that requestor cannot access the pages created in source requestor.


Refer following link for more details on Queue method:

https://pdn.pega.com/sites/pdn.pega.com/files/help_v721/procomhelpmain.htm#methods/queue/queue.htm

Published June 1, 2017 - Updated July 17, 2017


100% found this useful

Have a question? Get answers now.

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