How to enable queue to accept incoming messages from CLI

Options
Sbelag
Sbelag Member Posts: 6
edited February 20 in General Discussions #1

Hello, I m using solace cli to provision a queue in the router, but I m not able to find the command that enable the incoming / outgoing functionality that I can see in the solace console UI.
This is a snippet of the script :

configure
message-spool message-vpn default
create queue dev/st1/q1/p1
access-type non-exclusive
subscription topic dev/st1/q1/p1/*
subscription topic dev/st1/q1/p1/>
owner solace-user
permission all consume
end

Finally is there a location in the router were I can get a script executed automatically at startup ?
Thank you.

Tagged:

Best Answers

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 534 admin
    edited February 20 #2 Answer ✓
    Options

    Hey @Sbelag , you'd want to try one of the following:

    no shutdown
    no shutdown ingress
    no shutdown egress
    

    The "shutdown" command occurs on many Solace objects in the Solace CLI (queues, message VPNs, client usernames, caches, remote VPN bridges, etc.). The "no" version does the opposite: enabling it.

    (if not doing a "shutdown" command, the "no" version of a CLI command usually resets something to the default value, like a port configuration)

    If you have access to the actual CLI via SSH, remember that you can always hit [TAB] x2 to find any context help or auto-completion support for the command that you're typing in.

    Finally: I'm pretty sure there isn't a (supported) way of auto-running a CLI script upon startup. There might be some way to do it, but I don't know. Generally, Solace would recommend using SEMPv2 or dSEMP/Terraform to configure the broker once it's up and stable.

  • Sbelag
    Sbelag Member Posts: 6
    #3 Answer ✓
    Options

    NVM !! I found the issue related to the CLI . I was doing it the wrong way .

    to execute a cli script :
    1- copy the script.cli file to the /usr/sw/jail/cliscripts folder
    2- from the console (ssh or the docker Exec console or java api ) run : /usr/sw/loads/currentload/bin/cli -A -es script.cli instead of : /usr/sw/loads/currentload/bin/cli -A -es /usr/sw/jail/cliscripts/script.cli

    finally I m using TestContainers API so Im executing the command as following :
    solaceContainer.execInContainer("/usr/sw/loads/currentload/bin/cli", "-A", "-es", "script.cli");
    I hope this will help someone else in the future
    Thank you.

Answers

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 534 admin
    edited February 20 #4 Answer ✓
    Options

    Hey @Sbelag , you'd want to try one of the following:

    no shutdown
    no shutdown ingress
    no shutdown egress
    

    The "shutdown" command occurs on many Solace objects in the Solace CLI (queues, message VPNs, client usernames, caches, remote VPN bridges, etc.). The "no" version does the opposite: enabling it.

    (if not doing a "shutdown" command, the "no" version of a CLI command usually resets something to the default value, like a port configuration)

    If you have access to the actual CLI via SSH, remember that you can always hit [TAB] x2 to find any context help or auto-completion support for the command that you're typing in.

    Finally: I'm pretty sure there isn't a (supported) way of auto-running a CLI script upon startup. There might be some way to do it, but I don't know. Generally, Solace would recommend using SEMPv2 or dSEMP/Terraform to configure the broker once it's up and stable.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 534 admin
    edited February 20 #5
    Options

    BTW, as an ex-CLI hacker, I'd always suggest including home and then enable at the start of your CLI scripts to ensure your session is at the "right level", no matter where/when the CLI code gets executed.

    Also, with regards to proper subscription management, you have redundant subs:

    subscription topic dev/st1/q1/p1/*
    subscription topic dev/st1/q1/p1/>
    

    The 2nd one covers the 1st one! The first one is unnecessary if the 2nd one exists. The > wildcard means "1-or-more" levels. So it would cover the * wildcard of just one level. Typically in Solace-world, you might want to match dev/st1/q1/p1 and/or dev/st1/q1/p1/more/levels/here, and that would need two separate subs:

    subscription topic dev/st1/q1/p1
    subscription topic dev/st1/q1/p1/>
    

    Note, that Solace has introduced a magic wildcard for this 0-or-more levels behaviour (similar to MQTT) which would cause a match on either of these two situations… by using ASCII char 0x03. Check here for more details:

    But I don't think this weird ASCII char is supported in CLI. EDIT: nope, you can use this magic wildcard in CLI if you wish! By just doing the following:

    subscription topic hello/world/\03
    

    This essentially injects a subscription for hello/world/# MQTT-style subscription, meaning it can match hello/world or hello/world/a or hello/world/a/b/c. Cool..! 👍🏼

  • Sbelag
    Sbelag Member Posts: 6
    Options

    first of all Thank you very much @Aaron for you answer , its like having an autograph from my favorite Youtuber 😉.
    for the context , I'm spinning a Solace container using TestContainers for Integration testing purposes , Given the limitation in the TestContainers API configuration capabilities, I found my self learning Solace Cli ( at least I understand now why the broker given name is "ROUTER" :) ).
    However I'm facing an issue when I execute the script as following :

    cli -A -es /usr/sw/jail/cliscripts/script.cli

    I receive the following output:

    Solace PubSub+ Standard Version 10.6.1.67

    This Solace product is proprietary software of
    Solace Corporation. By accessing this Solace product
    you are agreeing to the license terms and conditions
    located at http://www.solace.com/license-software

    Copyright 2004-2024 Solace Corporation. All rights reserved.

    To purchase product support, please contact Solace at:
    https://solace.com/contact-us/

    Operating Mode: Message Routing Node

    But non of the expected queues or topics or users are created !?
    do you have any magical solution ? Thank you
    I ve also tried :
    /usr/sw/loads/currentload/bin/cli -A -es /usr/sw/jail/cliscripts/script.cli
    I received :
    Failed to execute init script /usr/sw/jail/cliscripts/script.cli
    the : ls -l output is
    -rwxrwxrwx 1 appuser root 1323 Feb 20 04:33 /usr/sw/jail/cliscripts/script.cli

  • Sbelag
    Sbelag Member Posts: 6
    #7 Answer ✓
    Options

    NVM !! I found the issue related to the CLI . I was doing it the wrong way .

    to execute a cli script :
    1- copy the script.cli file to the /usr/sw/jail/cliscripts folder
    2- from the console (ssh or the docker Exec console or java api ) run : /usr/sw/loads/currentload/bin/cli -A -es script.cli instead of : /usr/sw/loads/currentload/bin/cli -A -es /usr/sw/jail/cliscripts/script.cli

    finally I m using TestContainers API so Im executing the command as following :
    solaceContainer.execInContainer("/usr/sw/loads/currentload/bin/cli", "-A", "-es", "script.cli");
    I hope this will help someone else in the future
    Thank you.