How to get a message payload using SEMP V2 API (browse queues)

sjaak
sjaak Member Posts: 109 ✭✭✭
edited February 2022 in General Discussions #1

Hi,
We want to build a Chrome extension so we can view a message payload from the Solace Cloud queue management page. As a replacement of JMSToolbox. Question: which SEMP V2 API operation can we use to GET a message payload using a message-id as a parameter?

Tagged:

Comments

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    Hi Sjaak,

    Obtaining message payloads via the SEMP v2 API is not possible AFAIK.
    See the documentation https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/monitor/index.html#/queue/getMsgVpnQueueMsg
    The "data" element of getMsgVpnQueueMsg doesn't contain the payload.

    Since you are writing this as a chrome extension - I guess you are using JavaScript?
    If so you could look at connecting to Solace via the JavaScript API and then use a Queue Browser to obtain messages and dequeue them if required.

    Look for QueueBrowser in the API doc - I'll see if I can find an example:
    https://docs.solace.com/API-Developer-Online-Ref-Documentation/js/index.html

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    General tutorials on how to use the Javascript API are found here - I can't locate a queue browser example,
    https://github.com/SolaceSamples/solace-samples-javascript

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hi @sjaak, just to expand on @swenhelge's answer, we explicitly do not allow admin users access to message data as it is a security violation. Admin users and client users are separately authenticated and authorised.

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    How does JMSToolbox browse queues? Probably using a JMS based API? We're trying to find a solution so we don't need to use JMSToolbox anymore to view payloads.

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    btw: is the SEMP V2 API operation to GET a message payload on the roadmap? I'm trying to understand what the security concern is. A more fine-grained role-based access queue management console would probably solve this. That is how other platforms implement it.

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    JMS Toolbox uses JMS API and I assume it's using the QueueBrowser interface
    https://docs.solace.com/API-Developer-Online-Ref-Documentation/jms/javax/jms/QueueBrowser.html
    This is similar to the JavaScript QueueBrowser I mentioned above.

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    @swenhelge Got it. We'll have a look at both the JMS API and Javascript API's. For a Chrome extension, that could work. I'll check that within our team. Btw: any Javascript queue browser example is helpful :smile: Thank you.

  • amackenzie
    amackenzie Member, Employee Posts: 265 Solace Employee

    Hi. Interesting project you are engaged in. Hopefully you will be making your Chrome extension freely available and open source so we can all benefit ;)
    As mentioned above, it's not possible to get message payload from the management interfaces. JMSToolbox does not use SEMPv2 to retrieve messages from queues and durable topic endpoints. It uses a queue browser. It uses SEMPv2 for things you cannot do in JMS like getting a list of queues, DTEs but for the actual messages, it uses JMS Queue Browsing.
    So depending on what language you are writing the Chrome extension in, you will want to look into the QueueBrowser class for that language. If it's JavaScript, look at the API docs. Specifically here: https://docs.solace.com/API-Developer-Online-Ref-Documentation/js/solace.QueueBrowser.html
    JMSToolbox will retrieve the messages in batches (200 at a time by default, I believe) to display in their grid view. For all those messages, they are holding the full message in memory (headers and payload) for quick display of message details when you highlight one of the messages in the grid. So they are not getting the message metadata and then retrieving the payload later, it's all one step with the QueueBrowser.
    There is no "official" sample for the QueueBrowser in JS unfortunately. It's a fairly straightforward interface, though. Basically it's a non-destructive consumer.
    I hope that helps.

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    @amackenzie Thank you. Yes, an interesting project. Let's see how far we get. It's our number one priority when it comes to Solace and UX. Customers will like it and it will help to sell Solace to new Solace/Boomi customers. UX is important these days! :smile:

  • himanshu
    himanshu Member, Employee Posts: 67 Solace Employee
    edited February 2021 #11

    @sjaak - We have JMS example in our API archive. Please download the api and you can find the sample code for QueueBrowser here:
    sol-jms-10.10.0/samples/src/com/solacesystems/jms/samples/SolJMSQueueBrowser.java

  • swenhelge
    swenhelge Member, Employee Posts: 80 Solace Employee

    @himanshu - I think we'd ideally be looking for a Javascript example using QueueBrowser. However exploring the JMS code may serve as inspiration to create the Javascript ...

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    For your info. We have an internal hackaton planned for March 10. Topic: Chrome extension for Solace. I'll keep you posted :smile:

  • himanshu
    himanshu Member, Employee Posts: 67 Solace Employee

    @sjaak said:
    For your info. We have an internal hackaton planned for March 10. Topic: Chrome extension for Solace. I'll keep you posted :smile:

    Nice! Looking forward to it!

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 957 admin

    @sjaak said:
    For your info. We have an internal hackaton planned for March 10. Topic: Chrome extension for Solace. I'll keep you posted :smile:

    Awesome! Can't wait to see what you come up with

  • PimvdNoll
    PimvdNoll Member Posts: 7

    Kudo's Axel! well done

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    Super nice Axel! :smiley: You nailed it

  • himanshu
    himanshu Member, Employee Posts: 67 Solace Employee

    Very cool, would love to see a write-up/code to see how you did it! Maybe you can present it in the next round of lightening talks as well! :)

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 957 admin

    @axeltrip this is awesome, thanks for sharing. I'd love to see more info as well! Like, how do I use it :)

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    We'll post some more info soon. The core is ready, we now need to make it ready for a release. Stay tuned!

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin

    Sounds good! @sjaak We have a Solace Community Github if you were wondering for a place for the source code 🙌

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 623 admin

    Holy crap, that's awesome!! Nicely done!

  • PimvdNoll
    PimvdNoll Member Posts: 7

    Ok, community it's on Github now! 🚀
    Please take a look at https://github.com/appronto/Solace-browser-extension
    We have included a readme with the instructions. Note that this is an experimental Chrome browser extension, so use at your own risk. We would love to see this on https://github.com/SolaceCommunity ( @Tamimi ?) so everybody can contribute and make this extension even better so we can publish it to the Chrome extension store as well for easier installation!
    Kudos to our colleague @axeltrip who has built this initial extension during our famous R&D days at Appronto!

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    Very nice @axeltrip and @PimvdNoll. Thanks for your support.

  • sjaak
    sjaak Member Posts: 109 ✭✭✭
    edited March 2021 #26

    Community: this is just the core functionality. It would be nice to add must-have features such as "dynamic queue" selection etc. Who is next? :)

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin

    That sounds great, @PimvdNoll ! I will get in touch with you for this and see what modifications are needed before we publish to the community page, and we can also add issues to the repo for people to pick up :) Kudos to you and @axeltrip 🙌

  • leonard
    leonard Member Posts: 10 ✭✭

    The Chrome extension has received a major update, now offering the following features:

    • Support for storing multiple 'Connections,' making it easy to switch between environments.
    • AES-GCM encryption for securely storing user passwords for each Connection.
    • Import/export functionality for Connections.

    Additionally, several quality-of-life improvements have been added. You can check out the update on the Chrome Store or directly from the GitHub repository.

    As always please do let us know if you find any unexpected behavior or issues!

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 957 admin

    Awesome, thanks for sharing @l16phill. And thanks to you and the team that worked on it!

  • sjaak
    sjaak Member Posts: 109 ✭✭✭

    Kudos for @leonard 😀 Great job!