# Remove items in "Ready to process" from Queue Processor

**URL:** <https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059>\
**Category:** General\
**Tags:** 8-3-1, case-management\
**Created:** [January 19, 2021, 6:22pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059 "2021-01-19T18:22:56Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![VVODNALA](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@VVODNALA](https://forums.pega.com/u/VVODNALA)\
**Post date:** [January 19, 2021, 6:22pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/1 "2021-01-19T18:22:56Z")

</div>

We have a queue processor ‘pyProcessNotification’ not running and about 100k items are in the “Ready to Process” state. How can we delete/clear the queue since we don’t want to trigger notifications for old items.

Pega version is 8.3.1

Thank you

---

<div class="post-metadata">

**Author:** ![Harish\_Gunneri](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Harish\_Gunneri](https://forums.pega.com/u/Harish_Gunneri)\
**Post date:** [January 21, 2021, 9:16pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/2 "2021-01-21T21:16:35Z")

</div>

@VVODNALA

You can create an activity with one Java step using the attached code.

Ensure to update the TopicName field in the attached code with your QP name in Capital letters for which you want to truncate the ready to process queue.

Let me know if that helps!!

[JavaStep.txt](https://forums.pega.com/uploads/short-url/bkGbao1LjIXLzO1moopEk07iuH6.txt) (1.12 KB)

---

<div class="post-metadata">

**Author:** ![pratik](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/pratik/32/372_2.png) [@pratik](https://forums.pega.com/u/pratik)\
**Post date:** [June 10, 2021, 12:09pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/3 "2021-06-10T12:09:12Z")

</div>

@VVODNALA Items queued to Queue Processors are pushed to Kafka, not database table.

In order to clear the queues, you can try removing the partition directories for your Queue Processor, which are created on the app filesystem. These partitions can be located in the ‘kafka-data’ directory on each app-node that supports ‘Stream’ service. For example, kafka-data can be located inside the tomcat installation directory for a Pega app running on tomcat.

Prior to removing the affected partitions from each node separately, ensure the app-servers are stopped to prevent replication between the Stream nodes. Otherwise the Stream service will repopulate the nodes with partition data soon as you remove it from any node within the cluster.

Let me know how this goes.

Pratik Agarwal

---

<div class="post-metadata">

**Author:** ![RaghuK60](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@RaghuK60](https://forums.pega.com/u/RaghuK60)\
**Post date:** [June 11, 2021, 8:31am UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/4 "2021-06-11T08:31:07Z")

</div>

@VVODNALA

What are the steps you performed let me know. Or else did i miss anything to clear the Ready to Process items in Queue Processor.

Thanks in Advance.

Raghu K

---

<div class="post-metadata">

**Author:** ![venkatak5332](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@venkatak5332](https://forums.pega.com/u/venkatak5332)\
**Post date:** [October 11, 2022, 9:24pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/5 "2022-10-11T21:24:18Z")

</div>

@Harish_Gunneri while runnig the activity with the above java code getting this error.

Java Exception: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.pega.fnx.stream.spi.StreamServiceException: Unknown stream ProcessFailedEvents

Can you please let me know solution for this.

---

<div class="post-metadata">

**Author:** ![Bharathan](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/bharathan/32/11102_2.png) [@Bharathan](https://forums.pega.com/u/Bharathan)\
**Post date:** [November 28, 2022, 1:56pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/6 "2022-11-28T13:56:42Z")

</div>

@venkatak5332,

Please go through the below article, hope it helps.

[Sizing queue processors and Stream data sets individually by changing the number of partitions of a topic | Pega](https://docs-previous.pega.com/decision-management/87/sizing-queue-processors-and-stream-data-sets-individually-changing-number-partitions-topic)

---

<div class="post-metadata">

**Author:** ![VVODNALA](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@VVODNALA](https://forums.pega.com/u/VVODNALA)\
**Post date:** [June 10, 2021, 1:12pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/7 "2021-06-10T13:12:14Z")

</div>

@Harish\_GCS : Thanks Harish. This worked for us.

---

<div class="post-metadata">

**Author:** ![RaghuK60](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@RaghuK60](https://forums.pega.com/u/RaghuK60)\
**Post date:** [June 10, 2021, 4:02pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/8 "2021-06-10T16:02:15Z")

</div>

@Harish\_GCS

Hi Harish,

I am also facing the issue. I have tried with the code which you shared but i am getting issue with the **withTopicName** method. Let me know is there any other way to clear the Ready to process queues from Queue Processor.

Error Details are below:

The method withTopicName(String) is undefined for the type StreamDataSetBuilder.

Thanks in Advance.

Regards,

Raghu Kumar K

---

<div class="post-metadata">

**Author:** ![SHAILENDRA](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@SHAILENDRA](https://forums.pega.com/u/SHAILENDRA)\
**Post date:** [January 4, 2022, 12:51pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/9 "2022-01-04T12:51:46Z")

</div>

@Harish_Gunneri This is really helpful and it helped us in clearing all the records

---

<div class="post-metadata">

**Author:** ![Harish\_Gunneri](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Harish\_Gunneri](https://forums.pega.com/u/Harish_Gunneri)\
**Post date:** [June 16, 2021, 12:26pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/10 "2021-06-16T12:26:32Z")

</div>

@RaghuK60 - Please use the attached java snippet for the latest versions.

[Delete R2P.txt](https://forums.pega.com/uploads/short-url/rhX1RMdXd52UwpeonwViE8t3zqo.txt) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![satishj17109538](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@satishj17109538](https://forums.pega.com/u/satishj17109538)\
**Post date:** [February 15, 2022, 9:55am UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/11 "2022-02-15T09:55:40Z")

</div>

@Harish_Gunneri

Could you please provide that Java code. i could not find the code in this thread.

---

<div class="post-metadata">

**Author:** ![Vamsi.Thatavarthi](https://avatars.discourse-cdn.com/v4/letter/v/59ef9b/32.png) [@Vamsi.Thatavarthi](https://forums.pega.com/u/Vamsi.Thatavarthi)\
**Post date:** [July 18, 2023, 11:27am UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/12 "2023-07-18T11:27:45Z")

</div>

Hello @Harish_Gunneri

We are on version, 8.6 and when trying to save the activity with the java code you provided, resulted in the following compilation error

**The method withTopicName(String) is undefined for the type StreamDataSetBuilder**

**Compile failed.**

---

<div class="post-metadata">

**Author:** ![Harish\_Gunneri](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Harish\_Gunneri](https://forums.pega.com/u/Harish_Gunneri)\
**Post date:** [February 15, 2022, 3:56pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/13 "2022-02-15T15:56:27Z")

</div>

@satishJ Attached the Java code

[Delete-ReadyToProcess-Entries.txt](https://forums.pega.com/uploads/short-url/uJo2ltzmunJezZ918zAavzfFrht.txt) (1.28 KB)

---

<div class="post-metadata">

**Author:** ![kratig14](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kratig14](https://forums.pega.com/u/kratig14)\
**Post date:** [February 28, 2022, 1:44pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/14 "2022-02-28T13:44:54Z")

</div>

@Harish_Gunneri , Hi Harish, We are getting com.pega.fnx.stream.spi.StreamServiceException: Stream SPI error in pega when running this code in our environment

---

<div class="post-metadata">

**Author:** ![Harish\_Gunneri](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Harish\_Gunneri](https://forums.pega.com/u/Harish_Gunneri)\
**Post date:** [March 3, 2022, 6:35pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/15 "2022-03-03T18:35:02Z")

</div>

@kratig14 - whic version of pega ?

---

<div class="post-metadata">

**Author:** ![VenkataDamarnathA](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/venkatadamarnatha/32/4741_2.png) [@VenkataDamarnathA](https://forums.pega.com/u/VenkataDamarnathA)\
**Post date:** [April 13, 2022, 8:33pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/16 "2022-04-13T20:33:04Z")

</div>

Hi For V8.2.8, here is the code

| java.util.ArrayList partitionKeys = new java.util.ArrayList\<\>();  
partitionKeys.add(“.pzMessageContent.pzInsKey”);  
com.pega.dsm.dnode.api.dataset.DataSet dataset = com.pega.dsm.dnode.api.dataset.stream.StreamDataSet.builder() .withClassName(“System-Message-QueueProcessor”) .withTopicName(“\<QP\_NAME IN CAPITAL LETTER\>”) .withPartitionKeys(partitionKeys) .withIdempotentSave(true) .withOperation(com.pega.dsm.dnode.api.dataset.operation.SaveOperation.NAME) .withOperation(com.pega.dsm.dnode.impl.dataset.kafka.KafkaGetTopicsOperation.NAME) .withOperation(com.pega.dsm.dnode.api.dataset.operation.BrowseOperation.NAME) .withOperation(com.pega.dsm.dnode.impl.dataset.kafka.KafkaDropOperation.NAME) .withOperation(com.pega.dsm.dnode.impl.dataset.kafka.KafkaTruncateOperation.NAME) .withSerde(com.pega.dsm.kafka.api.serde.ClipboardPageStreamSerde.create()) .build(tools); com.pega.dsm.dnode.api.dataset.operation.Operation operation = dataset.getOperationByName(com.pega.dsm.dnode.impl.dataset.kafka.KafkaTruncateOperation.NAME); ((com.pega.dsm.dnode.impl.dataset.kafka.KafkaTruncateOperation)operation).truncate().await(tools); |
| --- |

---

<div class="post-metadata">

**Author:** ![Harish\_Gunneri](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Harish\_Gunneri](https://forums.pega.com/u/Harish_Gunneri)\
**Post date:** [July 9, 2026, 5:40pm UTC](https://forums.pega.com/t/remove-items-in-ready-to-process-from-queue-processor/1059/17 "2026-07-09T17:40:27Z")

</div>

Hi All,

While using Delete ReadyToProcess Entries.txt java code in an activity. If we encounter any class cast error like java.lang.ClassCastException: class com.pega.dsm.dnode.impl.dataset.stream.StreamTruncateOperation cannot be cast to class.

You may use the below modified ja

[Delete-ReadyToProcess-Entries-Pega24-Fix.txt](https://forums.pega.com/uploads/short-url/xLVS8Xjkv24L7OS8pz0284HfCPn.txt) (1.5 KB)

va version. (Tested on Pega 25 and 24 version)
