SEMP SCRIPT REQUIRED FOR UPDATING MAX TTL OF MULTIPLE QUEUES AT ONCE

yugalsharma
yugalsharma Member Posts: 1

I am using the following script in a batch file and it is throwing error: PATH NOT FOUND.

I have double checked the path of queue and can see it in pubsub+ broker.

What am I missing here?

———————————————-

@echo off
setlocal enabledelayedexpansion

 

:: Define variables
set BROKER_ADDRESS=
set USERNAME=admin
set PASSWORD=admin
set MSG_VPN=default
set TTL_VALUE=180000

 

:: List of queues to update
set QUEUES=queue1 queue2 queue3

 

:: Loop through each queue and execute the curl command
for %%Q in (%QUEUES%) do (
    echo Updating queue: %%Q

    curl --verbose -X PATCH -u %USERNAME%:%PASSWORD% "%BROKER_ADDRESS%/SEMP/v2/config/msgVpns/%MSG_VPN%/queues/%%Q" ^
    -H "Content-Type: application/json" ^
    -d "{\"respectTtlEnabled\":true,\"maxTtl\":%TTL_VALUE%}"
)

 

echo All queues updated!
pause

Tagged:

Comments

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

    Hi @yugalsharma, welcome to the Community!

    Just eyeballing your script, nothing jumps out as being wrong… I'm guessing that something is getting messed up with the variable substitutions? Can you point the URL to some sort of request reflector, a test server?

    Otherwise… if you feel like doing a bit of config on the Solace broker, you can actually use it as a REST proxy, and "listen" to the REST requests/responses going through the broker. Essentially:

    • Configure a VPN to be in REST "gateway" mode
    • Configure an RDP that will forward any received REST messages to the SEMP port
    • Start a message listener (PubSub+ Manager Try Me, SdkPerf, my own PrettyDump utility) and listen on the correct topics

    Then you'd be able to see exactly what was going into the broker, and might help you determine why you're getting a "path not found" error.

    It'd be a bit of effort to type out all the steps needed for configuration (essentially following this self-guided CodeLab, but making sure your queue was listening to PATCH/> and setting the RDP remote host to localhost, port to 8080, and basic auth to admin/admin). Let me know if you've either figured out your issue already (and tell us what was wrong), or if you want to give my Solace gateway trick a try on your own, or if you'd really like the instructions. 👍🏼