Question

Are there any OOTB methods to re-queue the items in broken queue ?

Hi,

We can re-queue the item which is in broken queue manually. instead of re-queuing manually can we do the same programmatically through any OOTB ?

Thanks,
Srinivas

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

December 20, 2017 - 12:28am

Hi Srinivas,

Ideally, we should not do requeue the broken queue items automatically and instead increase the  "maxAtteps" value while calling the QueueForAgent activity or method because there is no control when the retrying should stop, however you can achieve it using the below java code (better to write in a function and call from whereever you want).

PRQueueManager qm = tools.getThread().getQueueManager();
return qm.repair(ItemID);

where ItemID is the Queue Item ID.

Get all the items from the Queue table where the status is "Broken-" and iterating on each item, call the above function.
You can check https://pdn.pega.com/how-requeue-failed-agent-items-broken-queue-items-report as well.

Thanks,
Ujjwal

December 20, 2017 - 2:55am
Response to UjjwalShukla_GCS

Thanks Ujjwal for the reply.

I have tried creating function with the code you have provided. I am getting the below errors.

Error(s) detected while generating java. Compiler reported: ----------
1. ERROR in /com/pegarules/generated/test_BrokenQueueFunction_010444_xLwzUGxOwzAhrdu46R71wQ.java (at line 88)
 PRQueueManager qm = tools.getThread().getQueueManager();
 ^^^^^
tools cannot be resolved
----------
2. ERROR in /com/pegarules/generated/test_BrokenQueueFunction_010444_xLwzUGxOwzAhrdu46R71wQ.java (at line 89)
 return qm.repair(ItemID);
 ^^^^^^^^^^^^^^^^^^^^^^^^^
Void methods cannot return a value
----------
2 problems (2 errors)
Compile failed.

Can you please correct me if I am wrong at creating the function.

Thanks,
Srinivas

December 20, 2017 - 3:14am
Response to Vaas9999

Hi Srinivas,

Try Below

  1. PublicAPI tools=ThreadContainer.get().getPublicAPI();
  2. try
  3. {
  4. PRQueueManager qm = tools.getThread().getQueueManager();
  5. qm.repair("MYQueueID");
  6. }
  7. catch(DatabaseException e){
  8. oLog.error("Caught exception:", e);
  9. throw new PRRuntimeException("CaughtDBException", e);
  10. }

Thanks,
Ujjwal