# Read retained messages from extension without subscribing?

**URL:** https://community.hivemq.com/t/read-retained-messages-from-extension-without-subscribing/2166
**Category:** HiveMQ Extensions
**Created:** [June 22, 2023, 1:56pm UTC](https://community.hivemq.com/t/read-retained-messages-from-extension-without-subscribing/2166 "2023-06-22T13:56:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RickBullotta](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@RickBullotta](https://community.hivemq.com/u/RickBullotta)
#### Post date: [June 22, 2023, 1:56pm UTC](https://community.hivemq.com/t/read-retained-messages-from-extension-without-subscribing/2166/1 "2023-06-22T13:56:13Z")

</div>

Is there an API in the extension framework that would permit reading a retained message from a topic without the overhead of spinning up a subscription and waiting for the response?

Thanks for any suggestions!

---

<div class="post-metadata">

### Author: ![AaronTLFranz](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/aarontlfranz/32/638_2.png) [@AaronTLFranz](https://community.hivemq.com/u/AaronTLFranz)
#### Post date: [June 22, 2023, 3:36pm UTC](https://community.hivemq.com/t/read-retained-messages-from-extension-without-subscribing/2166/2 "2023-06-22T15:36:54Z")

</div>

Hello @RickBullotta ,

After some review, we do not at present have an extension offering that will allow us to directly review retained messages without instantiating a subscribe request. With that said, there is a public repository, provided by Artcom, that offers a querying API, available [here](https://github.com/artcom/hivemq-retained-message-query-plugin). As with all public extension repositories not created by HiveMQ, please bear in mind that this is not maintained by HiveMQ.

We do also offer a [Message Log Extension](https://github.com/hivemq/hivemq-mqtt-message-log-extension/blob/master/README.adoc), which can be configured to log retained messages as they are created for a topic, though this would require custom configuration for appropriate filtering.

Best,  
Aaron from the HiveMQ Team

---

<div class="post-metadata">

### Author: ![RickBullotta](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@RickBullotta](https://community.hivemq.com/u/RickBullotta)
#### Post date: [June 22, 2023, 3:38pm UTC](https://community.hivemq.com/t/read-retained-messages-from-extension-without-subscribing/2166/3 "2023-06-22T15:38:39Z")

</div>

The Message Log Extension approach could work. I’m basically looking to build a REST API to read the last value received for a topic. I’d have to maintain a separate cache for the topics/messages, but I think I could make it work.
