Zend certified PHP/Magento developer

Magento2.4 – Retrieving queued messages

Is there a way to retrieve queued messages in Magento 2.4 code wise without the need to depend on what queue type is used (RabbitMq or db queue) for a specific topic?

I know that when using the db queue system I can query the queue_message table, but I don’t want to depend on the queue engine used.

I also don’t want to start processing the messages. I want just to check they are there in the queue.
So is there a method (class / interface) which achieves something like

$topicName = 'my.own.topic';
$queuedMessages = $something->getMessages($topic);