Try PubSub+

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

sjaaksjaak Member Posts: 54 ✭✭

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?

Comments

  • swenhelgeswenhelge Member, Employee Posts: 59 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

  • swenhelgeswenhelge Member, Employee Posts: 59 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

  • TomFTomF Member, Employee Posts: 199 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.

  • sjaaksjaak Member Posts: 54 ✭✭

    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.

  • sjaaksjaak Member Posts: 54 ✭✭

    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.

  • swenhelgeswenhelge Member, Employee Posts: 59 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.

  • sjaaksjaak Member Posts: 54 ✭✭

    @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.

  • amackenzieamackenzie Member, Employee Posts: 53 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.

  • sjaaksjaak Member Posts: 54 ✭✭

    @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:

  • himanshuhimanshu Member, Employee Posts: 31 Solace Employee
    edited February 4

    @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

  • swenhelgeswenhelge Member, Employee Posts: 59 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 ...

Sign In or Register to comment.