How To
Summary
How to clear message destination queue in CP4S in v1.11.x.
Objective
A message destination can contain old messages that can trigger warnings or can cause performance issues. If messages are no longer required to be processed, the queues can be deleted.
Steps
Clear the message destination queue.
1. Log in to the cluster by using either of the following commands.
- Using a username and password:
oc login <openshift_url> -u <username> -p <password>
- Using a token, which you can get from Red Hat OpenShift web console:
oc login --token=<token> --server=<openshift_url>
2. Extract Database Credentials and Connection Details
DBOUSER=$(oc extract secret/activemq-postgres-user --to - --keys user)
DBOPWD=$(oc extract secret/activemq-postgres-user --to - --keys password)
DBODB=activemq
DBOPORT=$(oc extract secret/activemq-postgres-user --to - --keys port)
DBOHOST=$(oc extract secret/activemq-postgres-user --to - --keys host)
These commands extract the PostgreSQL username, password, port, and host information from the
activemq-postgres-user secret and store them in environment variables.3. Check the message destination count in bytes:
QUERY1='select container, count(*), sum(length(msg)) as bytes from activemq_msgs group by container order by container;'
4. Execute the psql query from within the
cp-serviceability deployment pod using the oc exec command:
oc exec -it deploy/cp-serviceability -- psql "postgresql://$DBOUSER:$DBOPWD@$DBOHOST:$DBOPORT/$DBODB" -P pager off -c "$QUERY1"
This connects to the ActiveMQ PostgreSQL database using the extracted credentials and runs the query inside the target pod.
Example Output:
container | count | bytes
-------------------------------------------+-------+-------
queue://actions.201.fn_artifact_utils | 1 | 2184
queue://actions.201.fn_qradar_integration | 1 | 1996
queue://actions.201.fortigate | 2 | 4311
(3 rows)
5. To delete the queue://actions.201.fortigate
QUERY2="DELETE FROM activemq_msgs WHERE container = 'queue://actions.201.fortigate';"
oc exec -it deploy/cp-serviceability -- psql "postgresql://$DBOUSER:$DBOPWD@$DBOHOST:$DBOPORT/$DBODB" -P pager off -c "$QUERY2"
DELETE 2
6. Check the message destination count again
QUERY1='select container, count(*), sum(length(msg)) as bytes from activemq_msgs group by container order by container;'
oc exec -it deploy/cp-serviceability -- psql "postgresql://$DBOUSER:$DBOPWD@$DBOHOST:$DBOPORT/$DBODB" -P pager off -c "$QUERY1"
container | count | bytes
-------------------------------------------+-------+-------
queue://actions.201.fn_artifact_utils | 1 | 2184
queue://actions.201.fn_qradar_integration | 1 | 1996
(2 rows)
Related Information
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSTDPP","label":"IBM Cloud Pak for Security"},"ARM Category":[{"code":"a8m0z0000001h8pAAA","label":"Support-\u003ECases"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.11.0"}]
Was this topic helpful?
Document Information
Modified date:
10 July 2025
UID
ibm17236621